Search in sources :

Example 1 with LivingBuildingView

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);
    }
}
Also used : AssignUnassignMessage(com.minecolonies.coremod.network.messages.server.colony.building.home.AssignUnassignMessage) LivingBuildingView(com.minecolonies.coremod.colony.buildings.views.LivingBuildingView) ICitizenDataView(com.minecolonies.api.colony.ICitizenDataView)

Aggregations

ICitizenDataView (com.minecolonies.api.colony.ICitizenDataView)1 LivingBuildingView (com.minecolonies.coremod.colony.buildings.views.LivingBuildingView)1 AssignUnassignMessage (com.minecolonies.coremod.network.messages.server.colony.building.home.AssignUnassignMessage)1