diff --git a/src/com/lishid/openinv/OpenInvInventoryListener.java b/src/com/lishid/openinv/OpenInvInventoryListener.java index 2cd6b7c..c3a0a7c 100644 --- a/src/com/lishid/openinv/OpenInvInventoryListener.java +++ b/src/com/lishid/openinv/OpenInvInventoryListener.java @@ -20,6 +20,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryDragEvent; public class OpenInvInventoryListener implements Listener { @EventHandler(priority = EventPriority.NORMAL) @@ -32,4 +33,11 @@ public class OpenInvInventoryListener implements Listener { } // } } + + @EventHandler(priority = EventPriority.NORMAL) + public void onInventoryDrag(InventoryDragEvent event) { + if (!OpenInv.inventoryAccess.check(event.getInventory(), event.getWhoClicked())) { + event.setCancelled(true); + } + } } \ No newline at end of file diff --git a/src/com/lishid/openinv/internal/v1_9_R1/AnySilentChest.java b/src/com/lishid/openinv/internal/v1_9_R1/AnySilentChest.java index e87bfc0..ea73c6a 100644 --- a/src/com/lishid/openinv/internal/v1_9_R1/AnySilentChest.java +++ b/src/com/lishid/openinv/internal/v1_9_R1/AnySilentChest.java @@ -48,8 +48,7 @@ public class AnySilentChest implements IAnySilentChest { if (world.getType(new BlockPosition(x, y + 1, z)).l() || hasOcelotOnTop(world, x, y, z)) return true; - BlockPosition position = new BlockPosition(x, y, z); - int id = Block.getId(world.getType(position).getBlock()); + int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock()); // If block next to chest is chest and has a block or ocelot on top if (isBlockedChest(world, id, x - 1, y, z))