diff --git a/src/main/java/com/alttd/playershops/handler/ShopHandler.java b/src/main/java/com/alttd/playershops/handler/ShopHandler.java index 381e606..fed8c7f 100644 --- a/src/main/java/com/alttd/playershops/handler/ShopHandler.java +++ b/src/main/java/com/alttd/playershops/handler/ShopHandler.java @@ -218,7 +218,7 @@ public class ShopHandler { continue; } - Material material = shop.getItemStack().getType(); + Material material = shop.getShopItemType(); List shopList = shopByMaterialTreeSet.computeIfAbsent(material, v -> new ArrayList<>()); shopList.add(shop); } diff --git a/src/main/java/com/alttd/playershops/shop/PlayerShop.java b/src/main/java/com/alttd/playershops/shop/PlayerShop.java index 51c935e..1b3e0cf 100644 --- a/src/main/java/com/alttd/playershops/shop/PlayerShop.java +++ b/src/main/java/com/alttd/playershops/shop/PlayerShop.java @@ -433,12 +433,15 @@ public class PlayerShop { } public ItemStack getItemStack() { - if (!isInitialized()) + if (!isInitialized()) { return null; - if (this.getType() != ShopType.RANDOM) + } + if (this.getType() != ShopType.RANDOM) { return itemStack; - if (this.getInventory().isEmpty()) + } + if (this.getInventory() == null) { return null; + } ArrayList contents = new ArrayList<>(); for (ItemStack it : this.getInventory().getContents()) { if (it != null) { @@ -487,4 +490,11 @@ public class PlayerShop { return component; } + + public Material getShopItemType() { + if (this.type == ShopType.RANDOM) { + return Material.STRUCTURE_VOID; // TODO -- Load from config + } + return itemStack.getType(); + } }