@Override public void undoFromTemplate() { if (this.nextWallBuilt == null) { for (BlockCoord coord : wallBlocks.keySet()) { WallBlock wb = wallBlocks.get(coord); ItemManager.setTypeId(coord.getBlock(), wb.getOldId()); ItemManager.setData(coord.getBlock(), wb.getOldData()); try { wb.delete(); } catch (SQLException e) { e.printStackTrace(); } } // Remove this wall chunk. ChunkCoord coord = new ChunkCoord(this.getCorner()); CivGlobal.removeWallChunk(this, coord); } else { try { this.nextWallBuilt.processUndo(); } catch (CivException e) { e.printStackTrace(); } } }
@Override public void delete() throws SQLException { if (this.wallBlocks != null) { for (WallBlock wb : this.wallBlocks.values()) { wb.delete(); } } if (wallChunks != null) { for (ChunkCoord coord : wallChunks) { CivGlobal.removeWallChunk(this, coord); } } super.delete(); }