diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index e7dceb4d2..b2cd460af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -276,7 +276,8 @@ public class GameFlagManager implements Listener if (!game.InProgress()) return; - + + //normal inventories if (!game.InventoryOpenBlock) { if (event.getInventory().getType() == InventoryType.ANVIL || @@ -291,31 +292,35 @@ public class GameFlagManager implements Listener event.getInventory().getType() == InventoryType.ENDER_CHEST || event.getInventory().getType() == InventoryType.WORKBENCH || event.getInventory().getType() == InventoryType.CHEST) - { + { if (event.getInventory().getType() == InventoryType.CHEST) { - if (event.getInventory().getHolder() instanceof Chest) || !(event.getInventory() instanceof DoubleChest)) + if (event.getInventory().getHolder() != null && event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest) { event.setCancelled(true); event.getPlayer().closeInventory(); } } - - - event.setCancelled(true); - event.getPlayer().closeInventory(); + else + { + event.setCancelled(true); + event.getPlayer().closeInventory(); + } + } + } + + //deal with chests + if (!game.InventoryOpenChest) + { + if (event.getInventory().getType() == InventoryType.CHEST) + { + if (event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest) + { + event.setCancelled(true); + event.getPlayer().closeInventory(); + } } } - - -// if (!game.InventoryOpenChest) -// { -// if (event.getInventory().getType() == InventoryType.CHEST) -// { -// event.setCancelled(true); -// event.getPlayer().closeInventory(); -// } -// } } @EventHandler(priority = EventPriority.LOWEST)