Search in sources :

Example 1 with MainMenu

use of xyz.derkades.ublisk.iconmenus.MainMenu in project Ublisk by Derkades.

the class HelpMenu method onOptionClick.

@Override
public boolean onOptionClick(OptionClickEvent event) {
    String name = event.getName().toLowerCase();
    final UPlayer player = new UPlayer(event);
    if (name.contains("commands")) {
        new CommandsHelp(player).open();
    } else if (name.contains("faq")) {
    // TODO Open faq menu
    } else if (name.equals("back")) {
        new MainMenu(player).open();
    } else {
        player.sendMessage(Message.ERROR_MENU);
    }
    return false;
}
Also used : UPlayer(xyz.derkades.ublisk.utils.UPlayer) MainMenu(xyz.derkades.ublisk.iconmenus.MainMenu)

Example 2 with MainMenu

use of xyz.derkades.ublisk.iconmenus.MainMenu in project Ublisk by Derkades.

the class Menu method onCommand.

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (sender instanceof Player) {
        UPlayer player = new UPlayer(sender);
        new MainMenu(player).open();
        return true;
    } else {
        sender.sendMessage(Message.NOT_A_PLAYER.toString());
        return true;
    }
}
Also used : UPlayer(xyz.derkades.ublisk.utils.UPlayer) Player(org.bukkit.entity.Player) UPlayer(xyz.derkades.ublisk.utils.UPlayer) MainMenu(xyz.derkades.ublisk.iconmenus.MainMenu)

Example 3 with MainMenu

use of xyz.derkades.ublisk.iconmenus.MainMenu in project Ublisk by Derkades.

the class PlayerInteract method onInteract.

@EventHandler(ignoreCancelled = false)
public void onInteract(PlayerInteractEvent event) {
    UPlayer player = new UPlayer(event);
    Action action = event.getAction();
    if (action == Action.RIGHT_CLICK_BLOCK || action == Action.RIGHT_CLICK_AIR) {
        UInventory inv = player.getInventory();
        Material item = inv.getItemInMainHand().getType();
        if (item == Material.CHEST && !player.isInBuilderMode()) {
            new MainMenu(player).open();
            event.setCancelled(true);
        } else if (item == Material.END_CRYSTAL) {
            player.openEnderchest();
            event.setCancelled(true);
        }
    }
}
Also used : Action(org.bukkit.event.block.Action) UPlayer(xyz.derkades.ublisk.utils.UPlayer) UInventory(xyz.derkades.ublisk.utils.inventory.UInventory) Material(org.bukkit.Material) MainMenu(xyz.derkades.ublisk.iconmenus.MainMenu) EventHandler(org.bukkit.event.EventHandler)

Aggregations

MainMenu (xyz.derkades.ublisk.iconmenus.MainMenu)3 UPlayer (xyz.derkades.ublisk.utils.UPlayer)3 Material (org.bukkit.Material)1 Player (org.bukkit.entity.Player)1 EventHandler (org.bukkit.event.EventHandler)1 Action (org.bukkit.event.block.Action)1 UInventory (xyz.derkades.ublisk.utils.inventory.UInventory)1