@EventHandler public void onInventoryClose(InventoryCloseEvent event) { UUID uuid = event.getPlayer().getUniqueId(); if (currentTrade.containsKey(uuid)) { UUID other = currentTrade.remove(uuid); Player otherP = plugin.getServer().getPlayer(other); if (otherP != null && otherP.isOnline() && otherP.isValid()) { if (currentTrade.containsKey(other)) currentTrade.remove(other); event.getPlayer().sendMessage(ChatColor.RED + "The trade with " + otherP.getName() + " was canceled."); otherP.sendMessage(ChatColor.RED + "The trade with " + event.getPlayer().getName() + " was canceled."); otherP.closeInventory(); } else { event.getPlayer().sendMessage(ChatColor.RED + "The trade was canceled."); } } }
@EventHandler public void onInventoryClose(InventoryCloseEvent e) { if(!(e.getPlayer() instanceof Player)) return; Inventory inv = e.getInventory(); InventoryHolder holder = inv.getHolder(); if(holder != null && holder instanceof Menu) { Menu menu = (Menu) holder; menu.viewers.remove(e.getPlayer()); if(menu.viewers.size() == 0) openMenus.remove(menu); } }
@EventHandler public void onInventoryCloseEvent(InventoryCloseEvent e) { if (e.getPlayer().getGameMode() == GameMode.SPECTATOR) { if (e.getInventory().getName().equalsIgnoreCase(wm1.inv.getName())) { Bukkit.getScheduler().scheduleSyncDelayedTask(SuperiorCraft.plugin, new Runnable() { @Override public void run() { e.getPlayer().openInventory(wm2.inv); } }, 1); } else if (e.getInventory().getName().equalsIgnoreCase(wm2.inv.getName())) { if (e.getInventory().getName().equalsIgnoreCase(wm2.inv.getName())) { Bukkit.getScheduler().scheduleSyncDelayedTask(SuperiorCraft.plugin, new Runnable() { @Override public void run() { e.getPlayer().setGameMode(GameMode.ADVENTURE); } }, 1); } } } }
@EventHandler(priority = EventPriority.LOW) public void onInventoryClose(InventoryCloseEvent e) { Player p = (Player) e.getPlayer(); if(!inventories.containsKey(p)) return; SmartInventory inv = inventories.get(p); inv.getListeners().stream() .filter(listener -> listener.getType() == InventoryCloseEvent.class) .forEach(listener -> ((InventoryListener<InventoryCloseEvent>) listener).accept(e)); if(inv.isCloseable()) { e.getInventory().clear(); inventories.remove(p); } else Bukkit.getScheduler().runTask(plugin, () -> p.openInventory(e.getInventory())); }
@EventHandler public void onBackpackClose(InventoryCloseEvent event) { Inventory inventory = event.getInventory(); Player player = (Player) event.getPlayer(); if (!InventoryManager.playerIsLoaded(player) || !(inventory.getHolder() instanceof BackpackHolder)) { return; } PlayerWrapper playerWrapper = InventoryManager.get(player); Backpack backpack = playerWrapper.getBackpack(); if (backpack == null) { return; } backpack.onUse(); playerWrapper.setBackpack(null); }
@EventHandler public void onSupplyDropInventoryClose(InventoryCloseEvent e) { Location loc = e.getInventory().getLocation(); Block b = loc.getBlock(); if (b.getType() == Material.CHEST) { if (core.getSupplyDropManager().isSupplyDrop(b.getLocation())) { if (core.getSupplyDropManager().isEmpty(loc)) { core.getSupplyDropManager().removeSupplyDrop(loc); b.setType(Material.AIR); loc.getWorld().playSound(loc, Sound.BLOCK_WOOD_BREAK, 1, 1); } } } }
@EventHandler public void onClose(InventoryCloseEvent e) { Player p = (Player) e.getPlayer(); if (ChatColor.stripColor(e.getInventory().getTitle()).equals("장신구 장착")) { ItemStack slot1 = e.getInventory().getItem(20); ItemMeta slot1m = slot1.getItemMeta(); ArrayList list = Effect.effects; Iterator<Effect> i = list.iterator(); while (i.hasNext()) { try { Effect ee = i.next(); String lastWord = slot1m.getLore().get(0).substring(slot1m.getLore().get(0).lastIndexOf(" ")+1); if (ChatColor.stripColor(ee.getDisplayName()).equals(ChatColor.stripColor(slot1m.getLore().get(0).replace(lastWord,"{0}")))) { Effect.eventType(p,ee,"summon"); } } catch (Exception e1) { e1.printStackTrace(); } } } }
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = false) public void onClose(InventoryCloseEvent event) { if (!(event.getInventory().getHolder() instanceof MenuLink)) return; final VPPlayer player = VanillaPlusCore.getPlayerManager().getPlayer((Player) event.getPlayer()); final MenuLink menu = ((MenuLink) event.getInventory().getHolder()); Bukkit.getScheduler().scheduleSyncDelayedTask(VanillaPlus.getInstance(), new Runnable() { @Override public void run() { if(player.getPlayer().getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING){ menu.getIconMenu().closed(player, menu); }else{ menu.getIconMenu().changed(player, menu); } } }); }
@EventHandler public void onInventoryClose(InventoryCloseEvent event) { UUID uuid = event.getPlayer().getUniqueId(); if (invClickables.containsKey(uuid)) { HashMap<String, HashMap<String, Runnable>> invs = invClickables.get(uuid); String invName = event.getInventory().getName(); if (invName != null && invs.containsKey(invName)) { HashMap<String, Runnable> map = invs.remove(invName); map.clear(); map = null; } generalClickables.remove(uuid); } if (plugin.getPD((Player) event.getPlayer()) != null) plugin.getPD((Player) event.getPlayer()).currentModifiableInventory = null; }
@EventHandler(priority = EventPriority.HIGHEST) public void onClose(InventoryCloseEvent event) { final Player player = (Player) event.getPlayer(); User user = userManager.get(player.getUniqueId()); if(user.isFrozen() && options.modeFreezePrompt) { new BukkitRunnable() { @Override public void run() { new FreezeGui(player, options.modeFreezePromptTitle); } }.runTaskLater(StaffPlus.get(), 1L); return; }else if(user.getCurrentGui() != null) { user.setCurrentGui(null); } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void updateWorth(InventoryCloseEvent event) { // Do nothing if a player did not close the inventory or if chest // events are disabled. if (!(event.getPlayer() instanceof Player) || plugin.getSettings().isDisableChestEvents()) { return; } // Get cached values from when chest was opened and add the difference // to the worth manager. if (event.getInventory().getHolder() instanceof DoubleChest) { DoubleChest chest = (DoubleChest) event.getInventory().getHolder(); updateWorth((Chest) chest.getLeftSide()); updateWorth((Chest) chest.getRightSide()); } if (event.getInventory().getHolder() instanceof Chest) { updateWorth((Chest) event.getInventory().getHolder()); } }
@EventHandler public void onClose(InventoryCloseEvent event){ Inventory inv = event.getInventory(); if(inv.getName().equals("Equip Inventory")){ Player player = (Player) event.getPlayer(); Account account = new Account(player); ca.damocles.accountsystem.Character character = account.getLoadedCharacter(); player.getInventory().setHelmet(inv.getItem(1)); character.setEquip(Slot.HELMET, inv.getItem(1)); player.getInventory().setChestplate(inv.getItem(2)); character.setEquip(Slot.CHESTPLATE, inv.getItem(2)); player.getInventory().setLeggings(inv.getItem(6)); character.setEquip(Slot.LEGGINGS, inv.getItem(6)); player.getInventory().setBoots(inv.getItem(7)); character.setEquip(Slot.BOOTS, inv.getItem(7)); character.setEquip(Slot.BELT, inv.getItem(19)); character.setEquip(Slot.GLOVES, inv.getItem(20)); character.setEquip(Slot.RING1, inv.getItem(24)); character.setEquip(Slot.RING2, inv.getItem(25)); character.setEquip(Slot.SPELLBOOK, inv.getItem(37)); character.setEquip(Slot.BANK, inv.getItem(38)); character.setEquip(Slot.RING3, inv.getItem(42)); character.setEquip(Slot.RING4, inv.getItem(43)); } }
@EventHandler public void onInventoryClose(InventoryCloseEvent event){ for(Anvil an : animating){ if(event.getPlayer().equals(an.getPlayer())){ return; } } for(Anvil anvil : anvils){ if(event.getPlayer().equals(anvil.getPlayer())){ event.getPlayer().getInventory().setItemInMainHand(anvil.getItemStack()); anvil.deleteShowItem(); anvils.remove(anvil); return; } } }
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onInventoryClose(InventoryCloseEvent event) { Inventory bottomInventory = event.getView().getBottomInventory(); if(bottomInventory == null) return; if(bottomInventory.getType() != InventoryType.PLAYER) return; HumanEntity holder = ((PlayerInventory)bottomInventory).getHolder(); if(!(holder instanceof Player)) return; Player player = (Player)holder; PlayerData playerData = PlayerData.FromPlayer(player); sortPlayerIfEnabled(player, playerData, bottomInventory); if(player.getGameMode() != GameMode.CREATIVE && Math.random() < .1 && !playerData.isGotDepositAllInfo() && featureEnabled(Features.DepositAll, player)) { Inventory topInventory = event.getView().getTopInventory(); if(topInventory != null && topInventory.getType() == InventoryType.CHEST) { AutomaticInventory.sendMessage(player, TextMode.Instr, Messages.DepositAllAdvertisement); playerData.setGotDepositAllInfo(true); } } }
@EventHandler(priority = EventPriority.HIGHEST) public void restoreWoolChests(InventoryCloseEvent event) { HumanEntity human = event.getPlayer(); if (human instanceof Player) { GamePlayer player = this.game.getGame().getPlayer((Player) human); if (player == null) { return; } List<GamePlayer> viewers = new ArrayList<>(); for (HumanEntity humanViewer : event.getViewers()) { if (humanViewer instanceof Player) { GamePlayer viewer = this.game.getGame().getPlayer((Player) humanViewer); if (viewer != null) { viewers.add(viewer); } } } this.restoreWoolChest(event.getInventory().getHolder(), player, viewers); } }
@EventHandler(priority = EventPriority.LOWEST) public void onInventoryClose(InventoryCloseEvent event) { Window window = this.fetchWindow(event.getInventory()); if (window == null) { return; } GamePlayer player = this.fetchPlayer(event.getPlayer()); if (player == null) { return; } boolean close = window.close(player, false); if (!close) { // don't use the open(...) method in Window, because // it will handle the onOpen(...) event. event.getPlayer().openInventory(window.getContainer()); } }
@EventHandler public void onClose(InventoryCloseEvent event) { if (users.contains(event.getPlayer().getUniqueId())) { users.remove(event.getPlayer().getUniqueId()); for (int i = 0; i < 27; i ++) { ItemStack itemStack = event.getInventory().getItem(i); if (itemStack == null || itemStack.getType() == Material.AIR || !plugin.getFishManager().isCustomFish(itemStack)) { continue; } if (event.getPlayer().getInventory().firstEmpty() == -1) { event.getPlayer().getWorld().dropItem(event.getPlayer().getLocation(), itemStack); } else { event.getPlayer().getInventory().addItem(itemStack); } } } }
@EventHandler public void onClose(InventoryCloseEvent event) { if (users.contains(event.getPlayer().getUniqueId())) { users.remove(event.getPlayer().getUniqueId()); ItemStack[] rewards = new ItemStack[8]; for (int i = 0; i < 8; i ++) { ItemStack stack = event.getInventory().getItem(i); if (stack == null || stack.getType() == Material.AIR) continue; rewards[i] = stack; } plugin.getContestManager().setRewards(rewards); if (!editors.containsKey(event.getPlayer().getUniqueId())) { event.getPlayer().sendMessage(plugin.getLocale().getString("saved-changes")); } } }
@EventHandler public void onInventoryClose(InventoryCloseEvent e) { if (e.getInventory().getName() == null || !e.getInventory().getName().equals(inventory.getName())) { return; } if (!(e.getPlayer() instanceof Player) || !(((Player) e.getPlayer()).getUniqueId().equals( player.getPlayer().getUniqueId()))) { QuestManagerPlugin.logger.warning("Inventory menu event matched names," + " but not players! [" + e.getPlayer().getName() + "]"); return; } if (gui instanceof CloseableGui) { ((CloseableGui) gui).onClose(); } //our inventory is closing //unregister ourselves, unregister with handler, end HandlerList.unregisterAll(this); QuestManagerPlugin.questManagerPlugin.getInventoryGuiHandler().closeMenu((Player) e.getPlayer()); }
@EventHandler public void onInventoryCloseEvent(InventoryCloseEvent event) { //long time=System.nanoTime(); if(event.getInventory().getType()==InventoryType.CHEST&&CleanShop.shopScan) { Vector<ProtectedRegion> regions=null; if(event.getInventory().getHolder() instanceof Chest) regions=ShopUtils.getRegions(((Chest)event.getInventory().getHolder()).getLocation()); if(event.getInventory().getHolder() instanceof DoubleChest) regions=ShopUtils.getRegions(((DoubleChest)event.getInventory().getHolder()).getLocation()); if(regions!=null) for(ProtectedRegion p:regions) { if(p!=null) if(ShopUtils.shopExists(p)) { //plugin.calculateShopStock(plugin.getShop(p)); if(event.getInventory().getHolder() instanceof Chest) ChestUtils.calculateChestStock((Chest)event.getInventory().getHolder(), ShopUtils.getShop(p)); else ChestUtils.calculateChestStock((DoubleChest)event.getInventory().getHolder(), ShopUtils.getShop(p)); FileHandler.saveShops(); } } } }
@EventHandler public void inventoryClose(InventoryCloseEvent e) { Player p = (Player) e.getPlayer(); UUID uuid = p.getUniqueId(); if (p != null && p.isOnline()) { if (this.guiManager.isGUIEnabled() && this.guiManager.containsPlayer(uuid)) { if (!this.guiManager.isAllowedToClose()) { new BukkitRunnable() { @Override public void run() { Inventory inv = guiManager.refreshPersonalGUI(uuid); if (inv != null) { p.openInventory(inv); } } }.runTaskLater(this.plugin, 0L); } else { this.guiManager.removePlayer(uuid); } } } }
@EventHandler public void onClose(InventoryCloseEvent e) { final Player player = (Player) e.getPlayer(); if (openSelling.containsKey(player)) { Inventory inv = e.getInventory(); final ItemStack[] contents = inv.getContents(); int count = itemAmount(contents); if (count > 1) { Bukkit.getScheduler().scheduleSyncDelayedTask(Util.getMain(), new Runnable() { @Override public void run() { openSell(player); openSelling.get(player).setContents(contents); player.sendMessage(ChatColor.RED + "Please click the sell button or remove your items before closing!"); } }); } else { openSelling.remove(player); } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onChestClose(InventoryCloseEvent e) { if (!(e.getPlayer() instanceof Player)) return; final Player p = (Player) e.getPlayer(); if (!playerStateInfoMap.containsKey(p)) return; if (!(p.getInventory().getType() == InventoryType.CHEST || plugin.getVersionUtil().isOneDotXOrHigher(11) && isShulkerBox(p.getInventory()))) { return; } new BukkitRunnable() { @Override public void run() { StateInfo stateInfo = playerStateInfoMap.get(p); if (stateInfo == null) return; restoreState(stateInfo, p); playerStateInfoMap.remove(p); } }.runTaskLater(plugin, 1); }
@EventHandler void onInventoryClose(InventoryCloseEvent event){ if (event.getInventory().getTitle() != null && event.getInventory().getTitle().equals(this.name)) { if (this.edit){ for (int i = 0; i < this.size; i++){ try{ String flag = this.inv.getItem(i).getItemMeta().getLore().get(1).replace("§0", ""); if (RPConfig.getDefFlags().contains(flag)){ RPConfig.setGuiSlot(/*this.inv.getItem(i).getType().name(),*/ flag, i); } } catch (Exception e){ RPLang.sendMessage(this.player, "gui.edit.error"); close(); return; } } RPConfig.saveGui(); RPLang.sendMessage(this.player, "gui.edit.ok"); } close(); } }
@EventHandler public void onClose(InventoryCloseEvent event) { Menu menu = MenuAPI.i().getMenuRegistry().getByInventory(event.getInventory()); List<HumanEntity> viewers = event.getViewers(); if(menu != null) { viewers.remove(event.getPlayer()); // Precaution, really. if(viewers.size() == 0) { menu.getObjects().clear(); menu.getInventory().clear(); MenuAPI.i().getMenuRegistry().deregister(menu); } } }
@EventHandler public void onInventoryClose(InventoryCloseEvent event) { final NovaPlayer nPlayer = PlayerManager.getPlayer(event.getPlayer()); if(nPlayer.getGuiInventory() != null && !ChestGUIUtils.guiContinueList.contains(nPlayer)) { if(nPlayer.getGuiInventoryHistory().size() == 1) { nPlayer.setGuiInventory(null); } else { nPlayer.removeLastGUIInventoryHistory(); NovaGuilds.runTask(new Runnable() { @Override public void run() { nPlayer.getGuiInventory().open(nPlayer); } }); } } }
@EventHandler public void onInventoryClose(final InventoryCloseEvent event) { if (settingUpSigns.containsKey(event.getPlayer().getUniqueId())) { plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { @Override public void run() { if ((event.getPlayer().getOpenInventory().getTopInventory() == null || !event.getPlayer().getOpenInventory().getTopInventory().getTitle().startsWith("Buycraft: ")) && settingUpSigns.remove(event.getPlayer().getUniqueId()) != null && event.getPlayer() instanceof Player) { ((Player) event.getPlayer()).sendMessage(ChatColor.RED + "Buy sign set up cancelled."); } } }, 3); } }
@Override public void onInventoryClose(InventoryCloseEvent event) { ItemStack foundStack = null; for (ItemStack stack : event.getPlayer().getInventory().getContents()) { if (stack == null) { continue; } if (LoreMaterial.isCustom(stack)) { if (LoreMaterial.getMaterial(stack) instanceof UnitMaterial) { if (foundStack == null) { foundStack = stack; } else { event.getPlayer().getWorld().dropItem(event.getPlayer().getLocation(), stack); event.getPlayer().getInventory().remove(stack); } } } } }
@EventHandler public void onInventoryClose(InventoryCloseEvent event) { Inventory inventory = event.getInventory(); try { InventoryGui gui = getInventoryGuiById(HiddenId.grabId(inventory.getTitle())); guis.remove(gui); } catch (Exception ignored) { //inventory is not a gui -> do nothing } }
@EventHandler public void onCloseInventory(InventoryCloseEvent event) { String[] title = event.getInventory().getTitle().split("·"); if (title[0].equals("远程箱子")) { String chestType; if (title[1].equals("私有")) { chestType = "Private"; } else { chestType = "Public"; } String chestName = title[2]; Inventory inventory = event.getInventory(); if (doChest .saveChest(chestType, chestName.toLowerCase(), inventory)) { } else { getLogger().info("远程箱子保存失败"); } } }
@EventHandler public void onInventoryClose(InventoryCloseEvent event) { if (kettle.objects.openBackpacks.get(event.getPlayer()) != null) { String uuid = kettle.objects.openBackpacks.get(event.getPlayer()); kettle.objects.openBackpacks.remove(event.getPlayer()); for (ItemStack item : event.getPlayer().getInventory().getContents()) { if (item != null) { if (item.getType() == Material.CHEST) { if (item.getItemMeta().getLore().get(0) != null) { if (item.getItemMeta().getLore().get(0).equals(uuid)) { kettle.objects.getBackpack(uuid).setInventory(event.getInventory()); } } } } } } }
/** * Remove the store/unstore event possibility when an inventory is closed. * * @param evt The InventoryCloseEvent used to remove the possibility of a store/unstore * event */ @EventHandler public void onClose(InventoryCloseEvent evt) { if (evt.getView().getBottomInventory().getType() == InventoryType.PLAYER && (evt.getView().getTopInventory().getType() == InventoryType.CHEST || evt.getView().getTopInventory().getType() == InventoryType.ENDER_CHEST || evt.getView().getTopInventory().getType() == InventoryType.HOPPER || evt.getView().getTopInventory().getType() == InventoryType.DISPENSER || evt.getView().getTopInventory().getType() == InventoryType.DROPPER)) { if (storePossible.contains(evt.getPlayer())) { storePossible.remove(evt.getPlayer()); } else if (unstorePossible.contains(evt.getPlayer())) { unstorePossible.remove(evt.getPlayer()); } } }
@EventHandler(ignoreCancelled = true) private void closeMenu(InventoryCloseEvent event) { if (!(event.getPlayer() instanceof Player)) return; BTPlayer ply; try{ ply = plugin.getPlayerData().getBTPlayer((Player)event.getPlayer()); } catch (UnknownBTPlayerException e){ return; } MenuSession session = ply.getMenuSession(); if (session == null) { return; } session.current.onCloseMenu(ply); if (!ply.getNoClose()) { ply.setMenuSession(null); } }
@EventHandler public void onInventoryClose(final InventoryCloseEvent event) { final Inventory inventory = event.getInventory(); if (inventory.getName().equals(ONI)) { final HumanEntity entity = event.getPlayer(); if (entity instanceof Player) { final Player player = (Player) entity; playerManager.completeChallenge(player, inventory); // Drop remaining contents for (final ItemStack itemStack : inventory.getContents()) { if (itemStack != null) { worldManager.getWorld().dropItemNaturally(oniLocation, itemStack);// .setPickupDelay(20); } } } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onInventoryClose(InventoryCloseEvent event) { Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory()); if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) { return; } HumanEntity player = event.getPlayer(); if (!UserManager.hasPlayerDataKey(player)) { return; } furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, plugin); }
@EventHandler public void onClose(InventoryCloseEvent event) { Player player = (Player) event.getPlayer(); if (player.getGameMode() == GameMode.CREATIVE) { for (ItemStack item : player.getInventory().getContents()) { if (item != null) { ItemMeta meta = item.getItemMeta(); List<String> lore = new ArrayList<String>(); lore.add(ChatColor.YELLOW + "Creative"); BytecraftPlayer p = this.plugin.getPlayer(player); lore.add(ChatColor.YELLOW + "by: " + p.getDisplayName()); meta.setLore(lore); item.setItemMeta(meta); } } } }
@EventHandler(priority = EventPriority.HIGHEST) public void inventoryClose(InventoryCloseEvent event) { if (event.getInventory().getName() .equals(ChatColor.LIGHT_PURPLE + "" + ChatColor.MAGIC + "abc" + ChatColor.RESET + ChatColor.DARK_PURPLE + " Runecrafting " + ChatColor.LIGHT_PURPLE + "" + ChatColor.MAGIC + "cba")) { ItemStack[] contents = event.getInventory().getContents(); HumanEntity p = event.getPlayer(); Location loc = p.getLocation().add(0, 1.25, 0); Vector velocity = loc.getDirection().multiply(0.25); if (contents[0] != null && !contents[0].getType().equals(Material.AIR)) if (p.getInventory().firstEmpty() == -1) p.getWorld().dropItem(loc, contents[0]).setVelocity(velocity); else p.getInventory().addItem(contents[0]); if (contents[1] != null && !contents[1].getType().equals(Material.AIR)) if (p.getInventory().firstEmpty() == -1) p.getWorld().dropItem(loc, contents[1]).setVelocity(velocity); else p.getInventory().addItem(contents[1]); } }
@EventHandler public void onInventoryClose(final InventoryCloseEvent event) { try { InventoryViewManager.debug("onInventoryClose", "onInventoryClose(" + event.getPlayer().getName() + ", " + event.getInventory() + ") called!"); final Inventory inv = event.getInventory(); if (!this.invMap.containsKey(inv)) { return; } if (inv.getViewers().size() > 1) { InventoryViewManager.debug("onInventoryClose", "Returning because inv still has viewers..."); return; } final int invId = this.invMap.get(inv); this.saveInventoryView(invId, inv); InventoryViewManager.debug("onInventoryClose", "Saved inventory '" + invId + "'"); } catch (final Exception e) { CraftoMessenger.report(this, "Failed to handle InventoryCloseEvent!", e); } }
@EventHandler(priority = EventPriority.HIGH) public void onInventoryClose(InventoryCloseEvent e) { // check inventory is (created) chest if (e.getInventory().getType() != InventoryType.CHEST) return; // check inventory is extended ender chest if (!e.getInventory().getName().startsWith("Ender Chest #")) return; String name = e.getPlayer().getName(); // check last channels table if (!lastChannels.containsKey(name)) return; // get channel byte channel = lastChannels.get(name); String playerName = owner.isShareExtendedChests() ? ChestContentHolder.DefaultChest : e.getPlayer().getName(); // save inventory contents ChestContentHolder.getInstance().getContent(playerName, channel) .setItems(e.getInventory().getContents()); Location location = lastLocations.get(name); if (location == null) return; ((Player) e.getPlayer()).playNote(location, (byte) 1, (byte) 0); }