Add a check if the shop block is an inventoryholder
This commit is contained in:
parent
8e606458b2
commit
d6d0556d5c
|
|
@ -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() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user