Search in sources :

Example 1 with ClickGuiButtonTriggerMessage

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();
    }
}
Also used : ClickGuiButtonTriggerMessage(com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage) RequestWindowCitizen(com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen)

Example 2 with ClickGuiButtonTriggerMessage

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));
    }
}
Also used : ClickGuiButtonTriggerMessage(com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage)

Example 3 with ClickGuiButtonTriggerMessage

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();
    }
}
Also used : ClickGuiButtonTriggerMessage(com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage) RequestWindowCitizen(com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen)

Example 4 with ClickGuiButtonTriggerMessage

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));
    }
}
Also used : ClickGuiButtonTriggerMessage(com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage)

Aggregations

ClickGuiButtonTriggerMessage (com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage)4 RequestWindowCitizen (com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen)2