Skip to content

Commit

Permalink
Fixed inv being null ruining things
Browse files Browse the repository at this point in the history
  • Loading branch information
Calcilore committed May 2, 2024
1 parent 922a18f commit 0973266
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/main/java/net/serble/estools/Commands/CChest.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,17 @@ private static void setItemTask(Inventory inv, int slot, ItemStack item) {
@EventHandler
public void onInventoryDrag(final InventoryDragEvent e) {
Inventory inv = cChests.get(e.getWhoClicked().getUniqueId());
if (!e.getInventory().equals(inv)) {
return;
}

if (inv.equals(e.getInventory())) {
// Check if any of the slots dragged are in the cChest
for (int slot : e.getRawSlots()) {
if (inv.equals(e.getView().getInventory(slot))) {
e.setCancelled(true);
return;
}
}
}
// Check if any of the slots dragged are in the cChest
for (int slot : e.getRawSlots()) {
if (inv.equals(e.getView().getInventory(slot))) {
e.setCancelled(true);
return;
}
}
}

public static Inventory loadPlayer(Player p) {
Expand Down

0 comments on commit 0973266

Please sign in to comment.