Search in sources :

Example 6 with TextField

use of com.ldtteam.blockout.controls.TextField in project minecolonies by Minecolonies.

the class WindowPermissionsPage method addPlayerCLicked.

/**
 * Action performed when add player button is clicked.
 */
private void addPlayerCLicked() {
    final TextField input = findPaneOfTypeByID(INPUT_ADDPLAYER_NAME, TextField.class);
    Network.getNetwork().sendToServer(new PermissionsMessage.AddPlayer(building.getColony(), input.getText()));
    input.setText("");
}
Also used : PermissionsMessage(com.minecolonies.coremod.network.messages.PermissionsMessage) TextField(com.ldtteam.blockout.controls.TextField)

Example 7 with TextField

use of com.ldtteam.blockout.controls.TextField in project minecolonies by Minecolonies.

the class WindowPermissionsPage method addRank.

/**
 * Read the text input with the name of the rank to be added
 * If the chosen name is valid, send a message to the server, hide the error label and empty the input
 * else show the error label
 */
private void addRank() {
    final Text label = findPaneOfTypeByID(TOWNHALL_ADD_RANK_ERROR, Text.class);
    final TextField input = findPaneOfTypeByID(INPUT_ADDRANK_NAME, TextField.class);
    if (isValidRankname(input.getText())) {
        Network.getNetwork().sendToServer(new PermissionsMessage.AddRank(building.getColony(), input.getText()));
        input.setText("");
        label.hide();
    } else {
        label.show();
    }
}
Also used : PermissionsMessage(com.minecolonies.coremod.network.messages.PermissionsMessage) TextField(com.ldtteam.blockout.controls.TextField) Text(com.ldtteam.blockout.controls.Text)

Example 8 with TextField

use of com.ldtteam.blockout.controls.TextField in project minecolonies by ldtteam.

the class WindowPermissionsPage method addRank.

/**
 * Read the text input with the name of the rank to be added
 * If the chosen name is valid, send a message to the server, hide the error label and empty the input
 * else show the error label
 */
private void addRank() {
    final Text label = findPaneOfTypeByID(TOWNHALL_ADD_RANK_ERROR, Text.class);
    final TextField input = findPaneOfTypeByID(INPUT_ADDRANK_NAME, TextField.class);
    if (isValidRankname(input.getText())) {
        Network.getNetwork().sendToServer(new PermissionsMessage.AddRank(building.getColony(), input.getText()));
        input.setText("");
        label.hide();
    } else {
        label.show();
    }
}
Also used : PermissionsMessage(com.minecolonies.coremod.network.messages.PermissionsMessage) TextField(com.ldtteam.blockout.controls.TextField) Text(com.ldtteam.blockout.controls.Text)

Example 9 with TextField

use of com.ldtteam.blockout.controls.TextField in project minecolonies by ldtteam.

the class WindowPermissionsPage method addPlayerCLicked.

/**
 * Action performed when add player button is clicked.
 */
private void addPlayerCLicked() {
    final TextField input = findPaneOfTypeByID(INPUT_ADDPLAYER_NAME, TextField.class);
    Network.getNetwork().sendToServer(new PermissionsMessage.AddPlayer(building.getColony(), input.getText()));
    input.setText("");
}
Also used : PermissionsMessage(com.minecolonies.coremod.network.messages.PermissionsMessage) TextField(com.ldtteam.blockout.controls.TextField)

Example 10 with TextField

use of com.ldtteam.blockout.controls.TextField in project minecolonies by ldtteam.

the class WindowHutCrusherModule method saveCrushingMode.

/**
 * Save the crushing mode.
 */
private void saveCrushingMode() {
    final TextField crushingSettingsInput = findPaneOfTypeByID(QTY_INPUT, TextField.class);
    try {
        final int qty = Integer.parseInt(crushingSettingsInput.getText());
        building.setCrusherMode(mode, qty);
    } catch (final NumberFormatException ex) {
        Log.getLogger().warn("Wrong input!");
    }
}
Also used : TextField(com.ldtteam.blockout.controls.TextField)

Aggregations

TextField (com.ldtteam.blockout.controls.TextField)10 PermissionsMessage (com.minecolonies.coremod.network.messages.PermissionsMessage)4 Pane (com.ldtteam.blockout.Pane)2 Text (com.ldtteam.blockout.controls.Text)2 PostBoxRequestMessage (com.minecolonies.coremod.network.messages.server.colony.building.postbox.PostBoxRequestMessage)2 Block (net.minecraft.block.Block)2 ItemStack (net.minecraft.item.ItemStack)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 ResourceLocationException (net.minecraft.util.ResourceLocationException)2 BlockPos (net.minecraft.util.math.BlockPos)2 ChangeFreeToInteractBlockMessage (com.minecolonies.coremod.network.messages.server.colony.ChangeFreeToInteractBlockMessage)1