use of com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage in project minecolonies by Minecolonies.
the class WindowRequestDetail 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(REQUEST_FULLFIL)) {
if (this.prevWindow instanceof RequestWindowCitizen) {
((RequestWindowCitizen) this.prevWindow).fulfill(request);
// because this isn't an AbstractWindowSkeleton, and we want to trigger an advancement...
Network.getNetwork().sendToServer(new ClickGuiButtonTriggerMessage(button.getID(), Constants.MOD_ID + CITIZEN_REQ_DETAIL_SUFFIX));
}
this.window.close();
} else if (button.getID().equals(REQUEST_CANCEL)) {
if (this.prevWindow instanceof RequestWindowCitizen) {
((RequestWindowCitizen) this.prevWindow).cancel(request);
}
this.window.close();
} else {
prevWindow.open();
}
}
use of com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage in project minecolonies by Minecolonies.
the class AbstractWindowSkeleton method onButtonClicked.
/**
* Handle a button clicked event. Find the registered event and execute that.
* <p>
* todo: make final once migration is complete
*
* @param button the button that was clicked.
*/
@Override
public void onButtonClicked(@NotNull final Button button) {
if (buttons.containsKey(button.getID())) {
buttons.get(button.getID()).accept(button);
Network.getNetwork().sendToServer(new ClickGuiButtonTriggerMessage(button.getID(), this.resource));
}
}
use of com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage in project minecolonies by ldtteam.
the class WindowRequestDetail 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(REQUEST_FULLFIL)) {
if (this.prevWindow instanceof RequestWindowCitizen) {
((RequestWindowCitizen) this.prevWindow).fulfill(request);
// because this isn't an AbstractWindowSkeleton, and we want to trigger an advancement...
Network.getNetwork().sendToServer(new ClickGuiButtonTriggerMessage(button.getID(), Constants.MOD_ID + CITIZEN_REQ_DETAIL_SUFFIX));
}
this.window.close();
} else if (button.getID().equals(REQUEST_CANCEL)) {
if (this.prevWindow instanceof RequestWindowCitizen) {
((RequestWindowCitizen) this.prevWindow).cancel(request);
}
this.window.close();
} else {
prevWindow.open();
}
}
use of com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage in project minecolonies by ldtteam.
the class AbstractWindowSkeleton method onButtonClicked.
/**
* Handle a button clicked event. Find the registered event and execute that.
* <p>
* todo: make final once migration is complete
*
* @param button the button that was clicked.
*/
@Override
public void onButtonClicked(@NotNull final Button button) {
if (buttons.containsKey(button.getID())) {
buttons.get(button.getID()).accept(button);
Network.getNetwork().sendToServer(new ClickGuiButtonTriggerMessage(button.getID(), this.resource));
}
}
Aggregations