Add helper method to get shop item type.
This commit is contained in:
parent
11c5c69dc7
commit
c209e0098a
|
|
@ -218,7 +218,7 @@ public class ShopHandler {
|
|||
continue;
|
||||
}
|
||||
|
||||
Material material = shop.getItemStack().getType();
|
||||
Material material = shop.getShopItemType();
|
||||
List<PlayerShop> shopList = shopByMaterialTreeSet.computeIfAbsent(material, v -> new ArrayList<>());
|
||||
shopList.add(shop);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<ItemStack> 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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user