Add a check if the shop block is an inventoryholder

This commit is contained in:
Len 2026-08-06 08:31:15 -05:00
parent 8e606458b2
commit d6d0556d5c

View File

@ -148,9 +148,10 @@ public class PlayerShop {
} }
public Inventory getInventory() { public Inventory getInventory() {
// Could use a check if the block is still an InventoryHolder. if (shopLocation.getBlock().getState() instanceof InventoryHolder inventoryHolder) {
InventoryHolder container = (InventoryHolder) shopLocation.getBlock().getState(); return inventoryHolder.getInventory();
return container.getInventory(); }
return null;
} }
public boolean isInitialized() { public boolean isInitialized() {