public static ArrayList<BookletPage> getPagesForStack(ItemStack stack) { ArrayList<BookletPage> possiblePages = new ArrayList<BookletPage>(); for (BookletPage page : InitBooklet.pagesWithItemStackData) { if (ItemUtil.contains(page.getItemStacksForPage(), stack, true)) { possiblePages.add(page); } } return possiblePages; }
@EventHandler public void onAuroraInteract(PlayerInteractEvent e) { if (!WorldCheck.isEnabled(e.getPlayer().getWorld())) return; if (e.getAction() == Action.LEFT_CLICK_BLOCK && e.getClickedBlock().getY() < e.getPlayer().getLocation().getY() && ItemUtil.isSword(e.getPlayer().getItemInHand().getType()) && Races.getMGPlayer(e.getPlayer()).hasAbility(AbilityType.FROST)) { AbilityType.FROST.run(e.getPlayer()); } if (e.getAction() == Action.RIGHT_CLICK_AIR && PlayerUtil.isInWater(e.getPlayer()) && ItemUtil.isSword(e.getPlayer().getItemInHand().getType()) && Races.getMGPlayer(e.getPlayer()).hasAbility(AbilityType.DROWNINGPOOL)) { AbilityType.DROWNINGPOOL.run(e.getPlayer()); } if (e.getAction() == Action.LEFT_CLICK_AIR && e.getPlayer().getItemInHand().getType() == Material.SNOW_BALL && Races.getMGPlayer(e.getPlayer()).hasAbility(AbilityType.TIDALWAVE)) { AbilityType.TIDALWAVE.run(e.getPlayer()); } }
public static void giveAndEquipItem(Player p, ItemStack itm) { if (ItemUtil.isHelmet(itm.getType()) && ItemUtil.isEmpty(p.getInventory().getHelmet())) { p.getInventory().setHelmet(itm); } else if (ItemUtil.isChestplate(itm.getType()) && ItemUtil.isEmpty(p.getInventory().getChestplate())) { p.getInventory().setChestplate(itm); } else if (ItemUtil.isLeggings(itm.getType()) && ItemUtil.isEmpty(p.getInventory().getLeggings())) { p.getInventory().setLeggings(itm); } else if (ItemUtil.isBoots(itm.getType()) && ItemUtil.isEmpty(p.getInventory().getBoots())) { p.getInventory().setBoots(itm); } else { if (p.getInventory().getItemInHand() == null || p.getInventory().getItemInHand().getType() == Material.AIR) { p.getInventory().setItemInHand(itm); } else { p.getInventory().addItem(itm); } } }