use of com.minecolonies.coremod.colony.buildings.views.LivingBuildingView in project minecolonies by Minecolonies.
the class WindowAssignCitizen method onButtonClicked.
/**
* Called when any button has been clicked.
*
* @param button the clicked button.
*/
@Override
public void onButtonClicked(@NotNull final Button button) {
if (button.getID().equals(BUTTON_DONE)) {
final int row = citizenList.getListElementIndexByPane(button);
final ICitizenDataView data = citizens.get(row);
if (building instanceof LivingBuildingView) {
((LivingBuildingView) building).addResident(data.getId());
}
Network.getNetwork().sendToServer(new AssignUnassignMessage(this.building, true, data.getId(), null));
} else if (!button.getID().equals(BUTTON_CANCEL)) {
return;
}
if (colony.getTownHall() != null) {
building.openGui(false);
}
}
Aggregations