public static void open(Player p, int page) { Player p1 = p; Fireworks config = plugin.getFireworks(); GUI gui = buildGui( config.getGuiName(), config.getGuiSize(), config.getHomeItem(), config.getPreviousItem(), config.getNextItem()); for (FireworkStorage firework : config.getFireworks()) { int position = getRealPosition(firework.getPosition(), page, config.getGuiSize()); if (position != -1) { ItemStack item = firework.getItem().clone(); gui.setItem(position, item); if (config.isNoPermissionItemEnabled() && !Methods.hasPermission(p1, firework.getPermission())) { gui.setItem(position, config.getNoPermissionItem(firework)); } } } PlayerOpenGuiEvent event = new PlayerOpenGuiEvent(p1, gui); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) return; gui = event.getGui(); p1 = event.getPlayer(); PAGEMAP.put(p1.getName(), page); gui.open(p1); }
public static void open(Player p, int page) { Player p1 = p; Balloons config = plugin.getBalloons(); CosmeticsAPI api = plugin.getApi(); GUI gui = buildGui( config.getGuiName(), config.getGuiSize(), config.getHomeItem(), config.getPreviousItem(), config.getNextItem()); for (BalloonStorage balloon : config.getBalloons()) { int position = getRealPosition(balloon.getPosition(), page, config.getGuiSize()); if (position != -1) { ItemStack item = balloon.getItem().clone(); if (api.hasBalloon(p1)) { if (api.getBalloon(p1) .getBalloonStorage() .getIdentifier() .equals(balloon.getIdentifier())) item.addUnsafeEnchantment(glow, 1); } gui.setItem(position, item); if (config.isNoPermissionItemEnabled() && !Methods.hasPermission(p1, balloon.getPermission())) { gui.setItem(position, config.getNoPermissionItem(balloon)); } } } gui.setItem(config.getRemoveItem()); PlayerOpenGuiEvent event = new PlayerOpenGuiEvent(p1, gui); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) return; gui = event.getGui(); p1 = event.getPlayer(); PAGEMAP.put(p1.getName(), page); gui.open(p1); }