Rename Gamble shops to Random shops.
This commit is contained in:
@@ -88,7 +88,7 @@ public class PlayerShop {
|
||||
return 0;
|
||||
return (int) (balance / getPrice());
|
||||
}
|
||||
case GAMBLE -> {
|
||||
case RANDOM -> {
|
||||
ArrayList<ItemStack> contents = new ArrayList<>();
|
||||
for (ItemStack it : this.getInventory().getContents()) {
|
||||
if (it != null) {
|
||||
@@ -225,7 +225,7 @@ public class PlayerShop {
|
||||
return switch (getType()) {
|
||||
case SELL -> executeSellTransaction(orders, player);
|
||||
case BUY -> executeBuyTransaction(orders, player);
|
||||
case GAMBLE -> executeGambleTransaction(player);
|
||||
case RANDOM -> executeRandomTransaction(player);
|
||||
default -> TransactionError.NONE; // This should not happen
|
||||
};
|
||||
}
|
||||
@@ -312,7 +312,7 @@ public class PlayerShop {
|
||||
return TransactionError.NONE;
|
||||
}
|
||||
|
||||
private TransactionError executeGambleTransaction(Player player) {
|
||||
private TransactionError executeRandomTransaction(Player player) {
|
||||
ItemStack itemStack = getItemStack();
|
||||
if (itemStack == null)
|
||||
return TransactionError.INSUFFICIENT_FUNDS_SHOP;
|
||||
@@ -349,7 +349,7 @@ public class PlayerShop {
|
||||
InventoryUtils.addItem(player.getInventory(), itemStack);
|
||||
player.updateInventory();
|
||||
|
||||
addTransaction(new ShopTransaction(ShopAction.GAMBLE, player.getName(), 1, price));
|
||||
addTransaction(new ShopTransaction(ShopAction.RANDOM, player.getName(), 1, price));
|
||||
return TransactionError.NONE;
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ public class PlayerShop {
|
||||
public ItemStack getItemStack() {
|
||||
if (!isInitialized())
|
||||
return null;
|
||||
if (this.getType() != ShopType.GAMBLE)
|
||||
if (this.getType() != ShopType.RANDOM)
|
||||
return itemStack;
|
||||
if (this.getInventory().isEmpty())
|
||||
return null;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.alttd.playershops.shop;
|
||||
public enum ShopAction {
|
||||
BUY,
|
||||
SELL,
|
||||
GAMBLE,
|
||||
RANDOM,
|
||||
CREATE,
|
||||
CANCELLED;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ public enum ShopType {
|
||||
NONE(),
|
||||
SELL(),
|
||||
BUY(),
|
||||
GAMBLE();
|
||||
RANDOM();
|
||||
|
||||
private ShopTypeConfig shopTypeConfig;
|
||||
ShopType() {
|
||||
|
||||
Reference in New Issue
Block a user