use of com.minecolonies.coremod.network.messages.ColonyViewRemoveCitizenMessage in project minecolonies by Minecolonies.
the class CitizenManager method removeCitizen.
@Override
public void removeCitizen(@NotNull final CitizenData citizen) {
// Remove the Citizen
citizens.remove(citizen.getId());
if (citizen.getWorkBuilding() != null) {
citizen.getWorkBuilding().cancelAllRequestsOfCitizen(citizen);
}
if (citizen.getHomeBuilding() != null) {
citizen.getHomeBuilding().cancelAllRequestsOfCitizen(citizen);
}
for (@NotNull final AbstractBuilding building : colony.getBuildingManager().getBuildings().values()) {
building.removeCitizen(citizen);
}
colony.getWorkManager().clearWorkForCitizen(citizen);
// Inform Subscribers of removed citizen
for (final EntityPlayerMP player : colony.getPackageManager().getSubscribers()) {
MineColonies.getNetwork().sendTo(new ColonyViewRemoveCitizenMessage(colony, citizen.getId()), player);
}
colony.markDirty();
}
Aggregations