use of com.minecolonies.coremod.network.messages.client.colony.ColonyViewRemoveCitizenMessage in project minecolonies by Minecolonies.
the class CitizenManager method removeCivilian.
@Override
public void removeCivilian(@NotNull final ICivilianData citizen) {
if (!(citizen instanceof ICitizenData)) {
return;
}
// Remove the Citizen
citizens.remove(citizen.getId());
for (@NotNull final IBuilding building : colony.getBuildingManager().getBuildings().values()) {
for (final AbstractAssignedCitizenModule assignedCitizenModule : building.getModules(AbstractAssignedCitizenModule.class)) {
assignedCitizenModule.removeCitizen((ICitizenData) citizen);
}
}
colony.getWorkManager().clearWorkForCitizen((ICitizenData) citizen);
// Inform Subscribers of removed citizen
for (final ServerPlayerEntity player : colony.getPackageManager().getCloseSubscribers()) {
Network.getNetwork().sendToPlayer(new ColonyViewRemoveCitizenMessage(colony, citizen.getId()), player);
}
calculateMaxCitizens();
markDirty();
colony.markDirty();
}
use of com.minecolonies.coremod.network.messages.client.colony.ColonyViewRemoveCitizenMessage in project minecolonies by ldtteam.
the class CitizenManager method removeCivilian.
@Override
public void removeCivilian(@NotNull final ICivilianData citizen) {
if (!(citizen instanceof ICitizenData)) {
return;
}
// Remove the Citizen
citizens.remove(citizen.getId());
for (@NotNull final IBuilding building : colony.getBuildingManager().getBuildings().values()) {
for (final AbstractAssignedCitizenModule assignedCitizenModule : building.getModules(AbstractAssignedCitizenModule.class)) {
assignedCitizenModule.removeCitizen((ICitizenData) citizen);
}
}
colony.getWorkManager().clearWorkForCitizen((ICitizenData) citizen);
// Inform Subscribers of removed citizen
for (final ServerPlayerEntity player : colony.getPackageManager().getCloseSubscribers()) {
Network.getNetwork().sendToPlayer(new ColonyViewRemoveCitizenMessage(colony, citizen.getId()), player);
}
calculateMaxCitizens();
markDirty();
colony.markDirty();
}
Aggregations