use of com.minecolonies.coremod.network.messages.ColonyViewRemoveBuildingMessage in project minecolonies by Minecolonies.
the class BuildingManager method removeBuilding.
@Override
public void removeBuilding(@NotNull final AbstractBuilding building, final Set<EntityPlayerMP> subscribers) {
if (buildings.remove(building.getID()) != null) {
for (final EntityPlayerMP player : subscribers) {
MineColonies.getNetwork().sendTo(new ColonyViewRemoveBuildingMessage(colony, building.getID()), player);
}
Log.getLogger().info(String.format("Colony %d - removed AbstractBuilding %s of type %s", colony.getID(), building.getID(), building.getSchematicName()));
}
if (building instanceof BuildingTownHall) {
townHall = null;
} else if (building instanceof BuildingWareHouse) {
wareHouse = null;
}
colony.getRequestManager().onProviderRemovedFromColony(building);
// Allow Citizens to fix up any data that wasn't fixed up by the AbstractBuilding's own onDestroyed
for (@NotNull final CitizenData citizen : colony.getCitizenManager().getCitizens()) {
citizen.onRemoveBuilding(building);
}
colony.getCitizenManager().calculateMaxCitizens();
}
Aggregations