Fix some NPE caused by null itemstacks
This commit is contained in:
@@ -313,7 +313,7 @@ public class PlayerShop {
|
||||
}
|
||||
|
||||
private TransactionError executeGambleTransaction(Player player) {
|
||||
ItemStack itemStack = getRandomItem();
|
||||
ItemStack itemStack = getItemStack();
|
||||
if (itemStack == null)
|
||||
return TransactionError.INSUFFICIENT_FUNDS_SHOP;
|
||||
|
||||
@@ -419,9 +419,11 @@ public class PlayerShop {
|
||||
transactions.add(transaction);
|
||||
}
|
||||
|
||||
private ItemStack getRandomItem() {
|
||||
public ItemStack getItemStack() {
|
||||
if (!isInitialized())
|
||||
return null;
|
||||
if (this.getType() != ShopType.GAMBLE)
|
||||
return itemStack;
|
||||
if (this.getInventory().isEmpty())
|
||||
return null;
|
||||
ArrayList<ItemStack> contents = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user