Send different message for buying/selling from/to shop

This commit is contained in:
Stijn 2022-08-31 19:56:33 +02:00
parent 89acf0c10e
commit ad656391fb
2 changed files with 10 additions and 1 deletions

View File

@ -56,6 +56,8 @@ public class ShopTypeConfig {
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 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 shopInventoryFull = "<red>This shop does not have enough space in its inventory.";
public String shopNoStock = "<red>This shop is out of stock.";

View File

@ -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);
}