use of com.minecolonies.coremod.network.messages.AssignUnassignMessage 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 CitizenDataView data = citizens.get(row);
if (building instanceof BuildingHome.View) {
((BuildingHome.View) building).addResident(data.getId());
}
MineColonies.getNetwork().sendToServer(new AssignUnassignMessage(this.building, true, data.getId()));
} else if (!button.getID().equals(BUTTON_CANCEL)) {
return;
}
if (colony.getTownHall() != null) {
building.openGui(false);
}
}
use of com.minecolonies.coremod.network.messages.AssignUnassignMessage in project minecolonies by Minecolonies.
the class WindowHomeBuilding method removeClicked.
/**
* Action when the remove button is clicked.
*
* @param button the clicked button.
*/
private void removeClicked(@NotNull final Button button) {
if (building.getColony().isManualHousing()) {
final int row = citizen.getListElementIndexByPane(button);
final int citizenid = home.getResidents().get(row);
home.removeResident(row);
MineColonies.getNetwork().sendToServer(new AssignUnassignMessage(building, false, citizenid));
refreshView();
}
}
Aggregations