From ad656391fb60f0693730ce8adfefcf3c53687bea Mon Sep 17 00:00:00 2001 From: Stijn Date: Wed, 31 Aug 2022 19:56:33 +0200 Subject: [PATCH] Send different message for buying/selling from/to shop --- .../com/alttd/playershops/config/ShopTypeConfig.java | 2 ++ .../alttd/playershops/listener/TransactionListener.java | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/alttd/playershops/config/ShopTypeConfig.java b/src/main/java/com/alttd/playershops/config/ShopTypeConfig.java index f5a4855..95521e7 100644 --- a/src/main/java/com/alttd/playershops/config/ShopTypeConfig.java +++ b/src/main/java/com/alttd/playershops/config/ShopTypeConfig.java @@ -56,6 +56,8 @@ public class ShopTypeConfig { public String playerInventoryFull = "You do not have enough space in your inventory to buy from this shop."; public String playerNoFunds = "You do not have sufficient funds to trade with this shop."; public String playerBought = "You bought (s) from for ."; + public String playerSold = "You sold (s) to for ."; + public String shopBought = " sold (s) to you for ."; public String shopSold = " bought (s) from you for ."; public String shopInventoryFull = "This shop does not have enough space in its inventory."; public String shopNoStock = "This shop is out of stock."; diff --git a/src/main/java/com/alttd/playershops/listener/TransactionListener.java b/src/main/java/com/alttd/playershops/listener/TransactionListener.java index a53a94d..8c5c9a8 100644 --- a/src/main/java/com/alttd/playershops/listener/TransactionListener.java +++ b/src/main/java/com/alttd/playershops/listener/TransactionListener.java @@ -5,6 +5,7 @@ import com.alttd.playershops.gui.ShopManagementGui; import com.alttd.playershops.handler.ShopHandler; import com.alttd.playershops.hook.WorldGuardHook; import com.alttd.playershops.shop.PlayerShop; +import com.alttd.playershops.shop.ShopType; import com.alttd.playershops.shop.TransactionError; import com.alttd.playershops.utils.Logger; import com.alttd.playershops.utils.ShopUtil; @@ -136,7 +137,13 @@ public class TransactionListener extends EventListener { } return; } - player.sendActionBar(Util.parseMiniMessage(shop.getType().getShopTypeConfig().playerBought, placeholders)); + 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)); + } else { //TODO add messages for all shop types + player.sendActionBar(Util.parseMiniMessage("NOT IMPLEMENTED", placeholders)); + } plugin.getDatabaseHelper().logTransaction(player, shop, orders); }