use of com.minecolonies.coremod.network.messages.server.colony.building.home.AssignUnassignMessage in project minecolonies by Minecolonies.
the class WindowHutTavern 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);
Network.getNetwork().sendToServer(new AssignUnassignMessage(building, false, citizenid, null));
refreshView();
}
}
use of com.minecolonies.coremod.network.messages.server.colony.building.home.AssignUnassignMessage in project minecolonies by Minecolonies.
the class WindowAssignCitizen method hireClicked.
/**
* When assignment was clicked.
* @param button the clicked button.
*/
private void hireClicked(@NotNull final Button button) {
final int row = citizenList.getListElementIndexByPane(button);
final ICitizenDataView data = citizens.get(row);
final boolean isAssign = button.getText().getString().equals(new TranslationTextComponent("com.minecolonies.coremod.gui.hiring.buttonassign").getString());
if (isAssign) {
if (building.getResidents().size() >= building.getMax()) {
return;
}
building.addResident(data.getId());
data.setHomeBuilding(building.getPosition());
} else {
building.removeResident(data.getId());
data.setHomeBuilding(null);
}
Network.getNetwork().sendToServer(new AssignUnassignMessage(this.building, isAssign, data.getId(), null));
updateCitizens();
citizenList.refreshElementPanes();
}
use of com.minecolonies.coremod.network.messages.server.colony.building.home.AssignUnassignMessage in project minecolonies by Minecolonies.
the class WindowHutCitizen 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);
Network.getNetwork().sendToServer(new AssignUnassignMessage(building, false, citizenid, null));
refreshView();
}
}
use of com.minecolonies.coremod.network.messages.server.colony.building.home.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 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);
}
}
use of com.minecolonies.coremod.network.messages.server.colony.building.home.AssignUnassignMessage in project minecolonies by Minecolonies.
the class NetworkChannel method registerCommonMessages.
/**
* Registers all common messages.
*/
public void registerCommonMessages() {
setupInternalMessages();
int idx = 0;
registerMessage(++idx, ServerUUIDMessage.class, ServerUUIDMessage::new);
// ColonyView messages
registerMessage(++idx, ColonyViewMessage.class, ColonyViewMessage::new);
registerMessage(++idx, ColonyViewCitizenViewMessage.class, ColonyViewCitizenViewMessage::new);
registerMessage(++idx, ColonyViewRemoveCitizenMessage.class, ColonyViewRemoveCitizenMessage::new);
registerMessage(++idx, ColonyViewBuildingViewMessage.class, ColonyViewBuildingViewMessage::new);
registerMessage(++idx, ColonyViewRemoveBuildingMessage.class, ColonyViewRemoveBuildingMessage::new);
registerMessage(++idx, PermissionsMessage.View.class, PermissionsMessage.View::new);
registerMessage(++idx, ColonyStylesMessage.class, ColonyStylesMessage::new);
registerMessage(++idx, ColonyViewWorkOrderMessage.class, ColonyViewWorkOrderMessage::new);
registerMessage(++idx, ColonyViewRemoveWorkOrderMessage.class, ColonyViewRemoveWorkOrderMessage::new);
registerMessage(++idx, UpdateChunkCapabilityMessage.class, UpdateChunkCapabilityMessage::new);
// Permission Request messages
registerMessage(++idx, PermissionsMessage.Permission.class, PermissionsMessage.Permission::new);
registerMessage(++idx, PermissionsMessage.AddPlayer.class, PermissionsMessage.AddPlayer::new);
registerMessage(++idx, PermissionsMessage.RemovePlayer.class, PermissionsMessage.RemovePlayer::new);
registerMessage(++idx, PermissionsMessage.ChangePlayerRank.class, PermissionsMessage.ChangePlayerRank::new);
registerMessage(++idx, PermissionsMessage.AddPlayerOrFakePlayer.class, PermissionsMessage.AddPlayerOrFakePlayer::new);
registerMessage(++idx, PermissionsMessage.AddRank.class, PermissionsMessage.AddRank::new);
registerMessage(++idx, PermissionsMessage.RemoveRank.class, PermissionsMessage.RemoveRank::new);
registerMessage(++idx, PermissionsMessage.EditRankType.class, PermissionsMessage.EditRankType::new);
registerMessage(++idx, PermissionsMessage.SetSubscriber.class, PermissionsMessage.SetSubscriber::new);
// Colony Request messages
registerMessage(++idx, BuildRequestMessage.class, BuildRequestMessage::new);
registerMessage(++idx, OpenInventoryMessage.class, OpenInventoryMessage::new);
registerMessage(++idx, TownHallRenameMessage.class, TownHallRenameMessage::new);
registerMessage(++idx, MinerSetLevelMessage.class, MinerSetLevelMessage::new);
registerMessage(++idx, RecallCitizenMessage.class, RecallCitizenMessage::new);
registerMessage(++idx, BuildToolPlaceMessage.class, BuildToolPlaceMessage::new);
registerMessage(++idx, ToggleJobMessage.class, ToggleJobMessage::new);
registerMessage(++idx, HireFireMessage.class, HireFireMessage::new);
registerMessage(++idx, WorkOrderChangeMessage.class, WorkOrderChangeMessage::new);
registerMessage(++idx, AssignFieldMessage.class, AssignFieldMessage::new);
registerMessage(++idx, AssignmentModeMessage.class, AssignmentModeMessage::new);
registerMessage(++idx, GuardSetMinePosMessage.class, GuardSetMinePosMessage::new);
registerMessage(++idx, RecallCitizenHutMessage.class, RecallCitizenHutMessage::new);
registerMessage(++idx, TransferItemsRequestMessage.class, TransferItemsRequestMessage::new);
registerMessage(++idx, MarkBuildingDirtyMessage.class, MarkBuildingDirtyMessage::new);
registerMessage(++idx, ChangeFreeToInteractBlockMessage.class, ChangeFreeToInteractBlockMessage::new);
registerMessage(++idx, CreateColonyMessage.class, CreateColonyMessage::new);
registerMessage(++idx, ColonyDeleteOwnMessage.class, ColonyDeleteOwnMessage::new);
registerMessage(++idx, ColonyViewRemoveMessage.class, ColonyViewRemoveMessage::new);
registerMessage(++idx, GiveToolMessage.class, GiveToolMessage::new);
registerMessage(++idx, ToggleHousingMessage.class, ToggleHousingMessage::new);
registerMessage(++idx, ToggleMoveInMessage.class, ToggleMoveInMessage::new);
registerMessage(++idx, AssignUnassignMessage.class, AssignUnassignMessage::new);
registerMessage(++idx, OpenCraftingGUIMessage.class, OpenCraftingGUIMessage::new);
registerMessage(++idx, AddRemoveRecipeMessage.class, AddRemoveRecipeMessage::new);
registerMessage(++idx, ChangeRecipePriorityMessage.class, ChangeRecipePriorityMessage::new);
registerMessage(++idx, ChangeDeliveryPriorityMessage.class, ChangeDeliveryPriorityMessage::new);
registerMessage(++idx, ForcePickupMessage.class, ForcePickupMessage::new);
registerMessage(++idx, UpgradeWarehouseMessage.class, UpgradeWarehouseMessage::new);
registerMessage(++idx, BuildToolPasteMessage.class, BuildToolPasteMessage::new);
registerMessage(++idx, TransferItemsToCitizenRequestMessage.class, TransferItemsToCitizenRequestMessage::new);
registerMessage(++idx, UpdateRequestStateMessage.class, UpdateRequestStateMessage::new);
registerMessage(++idx, BuildingSetStyleMessage.class, BuildingSetStyleMessage::new);
registerMessage(++idx, RecallSingleCitizenMessage.class, RecallSingleCitizenMessage::new);
registerMessage(++idx, AssignFilterableItemMessage.class, AssignFilterableItemMessage::new);
registerMessage(++idx, TeamColonyColorChangeMessage.class, TeamColonyColorChangeMessage::new);
registerMessage(++idx, ColonyFlagChangeMessage.class, ColonyFlagChangeMessage::new);
registerMessage(++idx, ToggleHelpMessage.class, ToggleHelpMessage::new);
registerMessage(++idx, PauseCitizenMessage.class, PauseCitizenMessage::new);
registerMessage(++idx, RestartCitizenMessage.class, RestartCitizenMessage::new);
registerMessage(++idx, SortWarehouseMessage.class, SortWarehouseMessage::new);
registerMessage(++idx, PostBoxRequestMessage.class, PostBoxRequestMessage::new);
registerMessage(++idx, HireMercenaryMessage.class, HireMercenaryMessage::new);
registerMessage(++idx, HutRenameMessage.class, HutRenameMessage::new);
registerMessage(++idx, BuildingHiringModeMessage.class, BuildingHiringModeMessage::new);
registerMessage(++idx, DecorationBuildRequestMessage.class, DecorationBuildRequestMessage::new);
registerMessage(++idx, DecorationControllerUpdateMessage.class, DecorationControllerUpdateMessage::new);
registerMessage(++idx, DirectPlaceMessage.class, DirectPlaceMessage::new);
registerMessage(++idx, TeleportToColonyMessage.class, TeleportToColonyMessage::new);
registerMessage(++idx, EnchanterWorkerSetMessage.class, EnchanterWorkerSetMessage::new);
registerMessage(++idx, InteractionResponse.class, InteractionResponse::new);
registerMessage(++idx, TryResearchMessage.class, TryResearchMessage::new);
registerMessage(++idx, HireSpiesMessage.class, HireSpiesMessage::new);
registerMessage(++idx, AddMinimumStockToBuildingModuleMessage.class, AddMinimumStockToBuildingModuleMessage::new);
registerMessage(++idx, RemoveMinimumStockFromBuildingModuleMessage.class, RemoveMinimumStockFromBuildingModuleMessage::new);
registerMessage(++idx, FieldPlotResizeMessage.class, FieldPlotResizeMessage::new);
registerMessage(++idx, AdjustSkillCitizenMessage.class, AdjustSkillCitizenMessage::new);
registerMessage(++idx, BuilderSelectWorkOrderMessage.class, BuilderSelectWorkOrderMessage::new);
registerMessage(++idx, TriggerSettingMessage.class, TriggerSettingMessage::new);
registerMessage(++idx, AssignFilterableEntityMessage.class, AssignFilterableEntityMessage::new);
registerMessage(++idx, BuildPickUpMessage.class, BuildPickUpMessage::new);
registerMessage(++idx, SwitchBuildingWithToolMessage.class, SwitchBuildingWithToolMessage::new);
registerMessage(++idx, ColonyTextureStyleMessage.class, ColonyTextureStyleMessage::new);
registerMessage(++idx, MinerRepairLevelMessage.class, MinerRepairLevelMessage::new);
registerMessage(++idx, ResetFilterableItemMessage.class, ResetFilterableItemMessage::new);
registerMessage(++idx, CourierHiringModeMessage.class, CourierHiringModeMessage::new);
registerMessage(++idx, QuarryHiringModeMessage.class, QuarryHiringModeMessage::new);
registerMessage(++idx, ToggleRecipeMessage.class, ToggleRecipeMessage::new);
// Client side only
registerMessage(++idx, BlockParticleEffectMessage.class, BlockParticleEffectMessage::new);
registerMessage(++idx, CompostParticleMessage.class, CompostParticleMessage::new);
registerMessage(++idx, ItemParticleEffectMessage.class, ItemParticleEffectMessage::new);
registerMessage(++idx, LocalizedParticleEffectMessage.class, LocalizedParticleEffectMessage::new);
registerMessage(++idx, UpdateChunkRangeCapabilityMessage.class, UpdateChunkRangeCapabilityMessage::new);
registerMessage(++idx, OpenSuggestionWindowMessage.class, OpenSuggestionWindowMessage::new);
registerMessage(++idx, UpdateClientWithRecipesMessage.class, UpdateClientWithRecipesMessage::new);
registerMessage(++idx, CircleParticleEffectMessage.class, CircleParticleEffectMessage::new);
registerMessage(++idx, StreamParticleEffectMessage.class, StreamParticleEffectMessage::new);
registerMessage(++idx, SleepingParticleMessage.class, SleepingParticleMessage::new);
registerMessage(++idx, VanillaParticleMessage.class, VanillaParticleMessage::new);
registerMessage(++idx, StopMusicMessage.class, StopMusicMessage::new);
registerMessage(++idx, PlayAudioMessage.class, PlayAudioMessage::new);
registerMessage(++idx, PlayMusicAtPosMessage.class, PlayMusicAtPosMessage::new);
registerMessage(++idx, ColonyVisitorViewDataMessage.class, ColonyVisitorViewDataMessage::new);
registerMessage(++idx, SyncPathMessage.class, SyncPathMessage::new);
registerMessage(++idx, SyncPathReachedMessage.class, SyncPathReachedMessage::new);
// JEI Messages
registerMessage(++idx, TransferRecipeCraftingTeachingMessage.class, TransferRecipeCraftingTeachingMessage::new);
// Advancement Messages
registerMessage(++idx, OpenGuiWindowTriggerMessage.class, OpenGuiWindowTriggerMessage::new);
registerMessage(++idx, ClickGuiButtonTriggerMessage.class, ClickGuiButtonTriggerMessage::new);
// Colony-Independent items
registerMessage(++idx, RemoveFromRallyingListMessage.class, RemoveFromRallyingListMessage::new);
registerMessage(++idx, ToggleBannerRallyGuardsMessage.class, ToggleBannerRallyGuardsMessage::new);
// Research-related messages.
registerMessage(++idx, GlobalResearchTreeMessage.class, GlobalResearchTreeMessage::new);
// Crafter Recipe-related messages
registerMessage(++idx, CustomRecipeManagerMessage.class, CustomRecipeManagerMessage::new);
// Resource scroll NBT share message
registerMessage(++idx, ResourceScrollSaveWarehouseSnapshotMessage.class, ResourceScrollSaveWarehouseSnapshotMessage::new);
}
Aggregations