Fix players without permission to modify inventories inserting items
This commit is contained in:
@@ -20,6 +20,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
|
|
||||||
public class OpenInvInventoryListener implements Listener {
|
public class OpenInvInventoryListener implements Listener {
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@@ -48,8 +48,7 @@ public class AnySilentChest implements IAnySilentChest {
|
|||||||
if (world.getType(new BlockPosition(x, y + 1, z)).l() || hasOcelotOnTop(world, x, y, z))
|
if (world.getType(new BlockPosition(x, y + 1, z)).l() || hasOcelotOnTop(world, x, y, z))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
BlockPosition position = new BlockPosition(x, y, z);
|
int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
|
||||||
int id = Block.getId(world.getType(position).getBlock());
|
|
||||||
|
|
||||||
// If block next to chest is chest and has a block or ocelot on top
|
// If block next to chest is chest and has a block or ocelot on top
|
||||||
if (isBlockedChest(world, id, x - 1, y, z))
|
if (isBlockedChest(world, id, x - 1, y, z))
|
||||||
|
Reference in New Issue
Block a user