Added messages the shop owner gets when someone bought/sold something.

This commit is contained in:
Eric 2015-09-07 14:38:37 +02:00
parent 699ad6d5d4
commit b88d38c8f5
4 changed files with 20 additions and 1 deletions

View File

@ -131,10 +131,18 @@ messages:
# Usable regex: %AMOUNT%, %ITEMNAME%, %BUY-PRICE%, %CURRENCY-SYMBOL%, %VENDOR%
buy-success: "&aYou bought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%%CURRENCY-SYMBOL%&a from &6%VENDOR%&a."
# Set the message when the player successfully bought something.
# Set the message when the player successfully sold something.
# Usable regex: %AMOUNT%, %ITEMNAME%, %SELL-PRICE%, %CURRENCY-SYMBOL%, %VENDOR%
sell-success: "&aYou sold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%%CURRENCY-SYMBOL%&a to &6%VENDOR%&a."
# Set the message when a player bought something from the players' shop.
# Usable regex: %AMOUNT%, %ITEMNAME%, %BUY-PRICE%, %CURRENCY-SYMBOL%, %PLAYER%
someone-bought: "&6%PLAYER% &abought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%%CURRENCY-SYMBOL%&a from your shop."
# Set the message when a player sold something to the players' shop.
# Usable regex: %AMOUNT%, %ITEMNAME%, %SELL-PRICE%, %CURRENCY-SYMBOL%, %PLAYER%
someone-sold: "&6%PLAYER% &asold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%%CURRENCY-SYMBOL%&a from your shop."
# Set the message when the inventory is full when the player is buying something.
not-enough-inventory-space: "&cNot enough space in inventory."

View File

@ -134,6 +134,14 @@ public class Config {
return plugin.getConfig().getString("messages.sell-success").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.sellPrice, String.valueOf(sellPrice)).replace(Regex.vendor, vendor).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
}
public static String someone_bought(int amount, String itemName, double sellPrice, String player) {
return plugin.getConfig().getString("messages.someone-bought").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.sellPrice, String.valueOf(sellPrice)).replace(Regex.player, player).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
}
public static String someone_sold(int amount, String itemName, double sellPrice, String player) {
return plugin.getConfig().getString("messages.someone-sold").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.sellPrice, String.valueOf(sellPrice)).replace(Regex.player, player).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
}
public static String occupied_shop_slots(int limit, int amount) {
return plugin.getConfig().getString("messages.occupied-shop-slots").replace(Regex.limit, String.valueOf(limit)).replace(Regex.amount, String.valueOf(amount)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
}

View File

@ -14,5 +14,6 @@ public class Regex {
public static String buyPrice = "%BUY-PRICE%";
public static String sellPrice = "%SELL-PRICE%";
public static String limit = "%LIMIT%";
public static String player = "%PLAYER%";
}

View File

@ -342,6 +342,7 @@ public class InteractShop implements Listener{
leftAmount--;
} else if (leftAmount == 0) {
executor.sendMessage(Config.buy_success(product.getAmount(), ItemNames.lookup(product), shop.getBuyPrice(), shop.getVendor().getName()));
if (shop.getVendor().isOnline()) shop.getVendor().getPlayer().sendMessage(Config.someone_bought(product.getAmount(), ItemNames.lookup(product), shop.getBuyPrice(), executor.getName()));
return;
}
}
@ -416,6 +417,7 @@ public class InteractShop implements Listener{
leftAmount--;
} else if (leftAmount == 0) {
executor.sendMessage(Config.sell_success(product.getAmount(), ItemNames.lookup(product), shop.getSellPrice(), shop.getVendor().getName()));
if (shop.getVendor().isOnline()) shop.getVendor().getPlayer().sendMessage(Config.someone_sold(product.getAmount(), ItemNames.lookup(product), shop.getBuyPrice(), executor.getName()));
return;
}
}