commit
d23b8e0f1d
|
|
@ -55,7 +55,10 @@ public class ShopTypeConfig {
|
||||||
|
|
||||||
public String playerInventoryFull = "<red>You do not have enough space in your inventory to buy from this shop.";
|
public String playerInventoryFull = "<red>You do not have enough space in your inventory to buy from this shop.";
|
||||||
public String playerNoFunds = "<red>You do not have sufficient funds to trade with this shop.";
|
public String playerNoFunds = "<red>You do not have sufficient funds to trade with this shop.";
|
||||||
|
public String playerNoItems = "<red>You do not have sufficient items to trade with this shop.";
|
||||||
public String playerBought = "<white>You bought <amount> <item>(s) from <ownername> for <price>.";
|
public String playerBought = "<white>You bought <amount> <item>(s) from <ownername> for <price>.";
|
||||||
|
public String playerSold = "<white>You sold <amount> <item>(s) to <ownername> for <price>.";
|
||||||
|
public String shopBought = "<white><user> sold <amount> <item>(s) to you for <price>.";
|
||||||
public String shopSold = "<white><user> bought <amount> <item>(s) from you for <price>.";
|
public String shopSold = "<white><user> bought <amount> <item>(s) from you for <price>.";
|
||||||
public String shopInventoryFull = "<red>This shop does not have enough space in its inventory.";
|
public String shopInventoryFull = "<red>This shop does not have enough space in its inventory.";
|
||||||
public String shopNoStock = "<red>This shop is out of stock.";
|
public String shopNoStock = "<red>This shop is out of stock.";
|
||||||
|
|
@ -64,6 +67,9 @@ public class ShopTypeConfig {
|
||||||
private void transactionMessages() {
|
private void transactionMessages() {
|
||||||
playerInventoryFull = getString("transaction.player-inventory-full", playerInventoryFull);
|
playerInventoryFull = getString("transaction.player-inventory-full", playerInventoryFull);
|
||||||
playerNoFunds = getString("transaction.player-no-funds", playerNoFunds);
|
playerNoFunds = getString("transaction.player-no-funds", playerNoFunds);
|
||||||
|
playerNoItems = getString("transaction.player-no-items", playerNoItems);
|
||||||
|
playerBought = getString("transaction.player-bought", playerBought);
|
||||||
|
playerSold = getString("transaction.player-sold", playerSold);
|
||||||
shopInventoryFull = getString("transaction.shop-inventory-full", shopInventoryFull);
|
shopInventoryFull = getString("transaction.shop-inventory-full", shopInventoryFull);
|
||||||
shopNoStock = getString("transaction.shop-no-stock", shopNoStock);
|
shopNoStock = getString("transaction.shop-no-stock", shopNoStock);
|
||||||
yourShopNoFunds = getString("transaction.your-shop-no-funds", yourShopNoFunds);
|
yourShopNoFunds = getString("transaction.your-shop-no-funds", yourShopNoFunds);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.alttd.playershops.gui.ShopManagementGui;
|
||||||
import com.alttd.playershops.handler.ShopHandler;
|
import com.alttd.playershops.handler.ShopHandler;
|
||||||
import com.alttd.playershops.hook.WorldGuardHook;
|
import com.alttd.playershops.hook.WorldGuardHook;
|
||||||
import com.alttd.playershops.shop.PlayerShop;
|
import com.alttd.playershops.shop.PlayerShop;
|
||||||
|
import com.alttd.playershops.shop.ShopType;
|
||||||
import com.alttd.playershops.shop.TransactionError;
|
import com.alttd.playershops.shop.TransactionError;
|
||||||
import com.alttd.playershops.utils.Logger;
|
import com.alttd.playershops.utils.Logger;
|
||||||
import com.alttd.playershops.utils.ShopUtil;
|
import com.alttd.playershops.utils.ShopUtil;
|
||||||
|
|
@ -124,6 +125,9 @@ public class TransactionListener extends EventListener {
|
||||||
case INSUFFICIENT_FUNDS_PLAYER -> {
|
case INSUFFICIENT_FUNDS_PLAYER -> {
|
||||||
player.sendMiniMessage(shop.getType().getShopTypeConfig().playerNoFunds, placeholders);
|
player.sendMiniMessage(shop.getType().getShopTypeConfig().playerNoFunds, placeholders);
|
||||||
}
|
}
|
||||||
|
case INSUFFICIENT_ITEMS_PLAYER -> {
|
||||||
|
player.sendMiniMessage(shop.getType().getShopTypeConfig().playerNoItems, placeholders);
|
||||||
|
}
|
||||||
case INVENTORY_FULL_SHOP -> {
|
case INVENTORY_FULL_SHOP -> {
|
||||||
Player shopOwner = Bukkit.getPlayer(shop.getOwnerUUID());
|
Player shopOwner = Bukkit.getPlayer(shop.getOwnerUUID());
|
||||||
if (shopOwner != null && notifyOwner(shop)) {
|
if (shopOwner != null && notifyOwner(shop)) {
|
||||||
|
|
@ -138,7 +142,13 @@ public class TransactionListener extends EventListener {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (shop.getType().equals(ShopType.BUY))
|
||||||
|
player.sendActionBar(Util.parseMiniMessage(shop.getType().getShopTypeConfig().playerSold, placeholders));
|
||||||
|
else if (shop.getType().equals(ShopType.SELL)) {
|
||||||
player.sendActionBar(Util.parseMiniMessage(shop.getType().getShopTypeConfig().playerBought, placeholders));
|
player.sendActionBar(Util.parseMiniMessage(shop.getType().getShopTypeConfig().playerBought, placeholders));
|
||||||
|
} else { //TODO add messages for all shop types
|
||||||
|
player.sendActionBar(Util.parseMiniMessage("NOT IMPLEMENTED", placeholders));
|
||||||
|
}
|
||||||
plugin.getDatabaseHelper().logTransaction(player, shop, orders);
|
plugin.getDatabaseHelper().logTransaction(player, shop, orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ public class PlayerShop {
|
||||||
|
|
||||||
int playerItems = InventoryUtils.countItems(player.getInventory(), itemStack);
|
int playerItems = InventoryUtils.countItems(player.getInventory(), itemStack);
|
||||||
if (playerItems < itemStack.getAmount())
|
if (playerItems < itemStack.getAmount())
|
||||||
return TransactionError.INSUFFICIENT_FUNDS_PLAYER;
|
return TransactionError.INSUFFICIENT_ITEMS_PLAYER;
|
||||||
|
|
||||||
boolean hasFunds = EconomyUtils.hasSufficientFunds(this, price);
|
boolean hasFunds = EconomyUtils.hasSufficientFunds(this, price);
|
||||||
if (!hasFunds)
|
if (!hasFunds)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ public enum TransactionError {
|
||||||
CANCELLED,
|
CANCELLED,
|
||||||
INSUFFICIENT_FUNDS_SHOP,
|
INSUFFICIENT_FUNDS_SHOP,
|
||||||
INSUFFICIENT_FUNDS_PLAYER,
|
INSUFFICIENT_FUNDS_PLAYER,
|
||||||
|
INSUFFICIENT_ITEMS_PLAYER,
|
||||||
INVENTORY_FULL_SHOP,
|
INVENTORY_FULL_SHOP,
|
||||||
INVENTORY_FULL_PLAYER,
|
INVENTORY_FULL_PLAYER,
|
||||||
PLAYER_OFFLINE,
|
PLAYER_OFFLINE,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user