Skip to content

Commit

Permalink
don't use snapshots in custom InventoryHolders
Browse files Browse the repository at this point in the history
  • Loading branch information
Nacioszeczek committed Sep 23, 2023
1 parent 997e614 commit 3e39d2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/paper/dev/api/custom-inventory-holder.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void onInventoryClick(InventoryClickEvent event) {
Inventory inventory = event.getInventory();
// Check if the holder is our MyInventory,
// if yes, use instanceof pattern matching to store it in a variable immediately.
if (!(inventory.getHolder() instanceof MyInventory myInventory)) {
if (!(inventory.getHolder(false) instanceof MyInventory myInventory)) {
// It's not our inventory, ignore it.
return;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public void onInventoryClick(InventoryClickEvent event) {
// already has a stone in their inventory and clicks that one.
Inventory inventory = event.getClickedInventory();
// Add a null check in case the player clicked outside the window.
if (inventory == null || !(inventory.getHolder() instanceof MyInventory myInventory)) {
if (inventory == null || !(inventory.getHolder(false) instanceof MyInventory myInventory)) {
return;
}

Expand Down

0 comments on commit 3e39d2d

Please sign in to comment.