@Override public void repairStructure() throws CivException { double cost = getRepairCost(); if (!this.isValidWall()) { throw new CivException( "This wall is no longer valid and cannot be repaired. Walls can no longer overlap with protected structure blocks, demolish this wall instead."); } if (!getTown().getTreasury().hasEnough(cost)) { throw new CivException( "Your town cannot not afford the " + cost + " coins to build a " + getDisplayName()); } setHitpoints(this.getMaxHitPoints()); bindStructureBlocks(); for (WallBlock wb : this.wallBlocks.values()) { BlockCoord bcoord = wb.getCoord(); ItemManager.setTypeId(bcoord.getBlock(), wb.getTypeId()); ItemManager.setData(bcoord.getBlock(), wb.getData()); } save(); getTown().getTreasury().withdraw(cost); CivMessage.sendTown( getTown(), CivColor.Yellow + "The town has repaired a " + getDisplayName() + " at " + getCorner()); }