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;
}
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;
}
}
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);
}
}
}
Aggregations