Search in sources :

Example 1 with BlockValueGUI

use of com.iridium.iridiumskyblock.gui.BlockValueGUI in project IridiumSkyblock by Iridium-Development.

the class BlockValueCommand method execute.

/**
 * Executes the command for the specified {@link CommandSender} with the provided arguments.
 * Not called when the command execution was invalid (no permission, no player or command disabled).
 * Shows all the valuable blocks and spawners.
 *
 * @param sender    The CommandSender which executes this command
 * @param arguments The arguments used with this command. They contain the sub-command
 */
@Override
public boolean execute(CommandSender sender, String[] arguments) {
    Player player = (Player) sender;
    if (arguments.length != 2) {
        player.openInventory(new InventoryConfigGUI(IridiumSkyblock.getInstance().getInventories().blockValueSelectGUI, player.getOpenInventory().getTopInventory()).getInventory());
        return true;
    }
    BlockValueGUI.BlockValueType blockValueType = BlockValueGUI.BlockValueType.getType(arguments[1]);
    if (blockValueType == null) {
        player.openInventory(new InventoryConfigGUI(IridiumSkyblock.getInstance().getInventories().blockValueSelectGUI, player.getOpenInventory().getTopInventory()).getInventory());
        return true;
    }
    player.openInventory(new BlockValueGUI(blockValueType, player.getOpenInventory().getTopInventory()).getInventory());
    return true;
}
Also used : Player(org.bukkit.entity.Player) BlockValueType(com.iridium.iridiumskyblock.gui.BlockValueGUI.BlockValueType) BlockValueGUI(com.iridium.iridiumskyblock.gui.BlockValueGUI) InventoryConfigGUI(com.iridium.iridiumskyblock.gui.InventoryConfigGUI)

Aggregations

BlockValueGUI (com.iridium.iridiumskyblock.gui.BlockValueGUI)1 BlockValueType (com.iridium.iridiumskyblock.gui.BlockValueGUI.BlockValueType)1 InventoryConfigGUI (com.iridium.iridiumskyblock.gui.InventoryConfigGUI)1 Player (org.bukkit.entity.Player)1