Skip to content

Commit

Permalink
Fix players without permission to modify inventories inserting items
Browse files Browse the repository at this point in the history
  • Loading branch information
Jikoo committed Mar 1, 2016
1 parent 2d75225 commit 17b0cb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/com/lishid/openinv/OpenInvInventoryListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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)
Expand All @@ -32,4 +33,11 @@ public void onInventoryClick(InventoryClickEvent event) {
}
// }
}

@EventHandler(priority = EventPriority.NORMAL)
public void onInventoryDrag(InventoryDragEvent event) {
if (!OpenInv.inventoryAccess.check(event.getInventory(), event.getWhoClicked())) {
event.setCancelled(true);
}
}
}
3 changes: 1 addition & 2 deletions src/com/lishid/openinv/internal/v1_9_R1/AnySilentChest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public boolean IsAnyChestNeeded(Player p, int x, int y, int z) {
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))
Expand Down

0 comments on commit 17b0cb6

Please sign in to comment.