Skip to content

Commit

Permalink
Verificar se InventoryHolder é nulo
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock committed Mar 8, 2024
1 parent 6b658d8 commit ee7a166
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
Expand Down Expand Up @@ -171,6 +172,8 @@ public void onInventoryClick(InventoryClickEvent event) {
// Get the inventory.
Inventory inventory = event.getInventory();

if (inventory.getHolder() == null) return;

if (!(inventory.getHolder(false) instanceof CratePrizeMenu holder)) return;

Player player = holder.getPlayer();
Expand Down

0 comments on commit ee7a166

Please sign in to comment.