Fixed the block open flag.

This commit is contained in:
Mysticate 2015-08-28 15:46:38 -06:00
parent f21ca35638
commit 513662e6e3

View File

@ -277,6 +277,7 @@ public class GameFlagManager implements Listener
if (!game.InProgress()) if (!game.InProgress())
return; return;
//normal inventories
if (!game.InventoryOpenBlock) if (!game.InventoryOpenBlock)
{ {
if (event.getInventory().getType() == InventoryType.ANVIL || if (event.getInventory().getType() == InventoryType.ANVIL ||
@ -294,28 +295,32 @@ public class GameFlagManager implements Listener
{ {
if (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.setCancelled(true);
event.getPlayer().closeInventory(); event.getPlayer().closeInventory();
} }
} }
else
{
event.setCancelled(true); event.setCancelled(true);
event.getPlayer().closeInventory(); event.getPlayer().closeInventory();
} }
} }
}
//deal with chests
// if (!game.InventoryOpenChest) if (!game.InventoryOpenChest)
// { {
// if (event.getInventory().getType() == InventoryType.CHEST) if (event.getInventory().getType() == InventoryType.CHEST)
// { {
// event.setCancelled(true); if (event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest)
// event.getPlayer().closeInventory(); {
// } event.setCancelled(true);
// } event.getPlayer().closeInventory();
}
}
}
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)