Fixed the block open flag.
This commit is contained in:
parent
f21ca35638
commit
513662e6e3
@ -277,6 +277,7 @@ public class GameFlagManager implements Listener
|
||||
if (!game.InProgress())
|
||||
return;
|
||||
|
||||
//normal inventories
|
||||
if (!game.InventoryOpenBlock)
|
||||
{
|
||||
if (event.getInventory().getType() == InventoryType.ANVIL ||
|
||||
@ -294,28 +295,32 @@ public class GameFlagManager implements Listener
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (!game.InventoryOpenChest)
|
||||
// {
|
||||
// if (event.getInventory().getType() == InventoryType.CHEST)
|
||||
// {
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
Loading…
Reference in New Issue
Block a user