mirror of
https://github.com/Flowsqy/ShopChest.git
synced 2024-11-14 23:15:10 +01:00
Format Prices with Vault
ShopChest will now use the currency symbol specified in the configuration of the economy plugin.
This commit is contained in:
parent
01886ca88a
commit
260bc8f594
52
config.yml
52
config.yml
@ -147,8 +147,8 @@ messages:
|
||||
chest-no-shop: "&cChest is not a shop."
|
||||
|
||||
# Set the message when the player doesn't have enough money to create a shop
|
||||
# Usable Regex: %CREATION-PRICE%, %CURRENCY-SYMBOL%
|
||||
shop-create-not-enough-money: "&cNot enough money. You need &6%CREATION-PRICE%%CURRENCY-SYMBOL% &cto create a shop."
|
||||
# Usable Regex: %CREATION-PRICE%
|
||||
shop-create-not-enough-money: "&cNot enough money. You need &6%CREATION-PRICE% &cto create a shop."
|
||||
|
||||
shop-info:
|
||||
|
||||
@ -176,8 +176,8 @@ messages:
|
||||
none: "&7None"
|
||||
|
||||
# Set the price message the player gets after entering '/shop info'.
|
||||
# Usable regex: %BUY-PRICE%, %SELL-PRICE%, %CURRENCY-SYMBOL%
|
||||
price: "&6Price: Buy: &e%BUY-PRICE%%CURRENCY-SYMBOL%, &6Sell: &e%SELL-PRICE%%CURRENCY-SYMBOL%"
|
||||
# Usable regex: %BUY-PRICE%, %SELL-PRICE%
|
||||
price: "&6Price: Buy: &e%BUY-PRICE%&6 Sell: &e%SELL-PRICE%"
|
||||
|
||||
# If the sell price or buy price is disabled, this message will be displayed instead of the price and the currency symbol in the message above.
|
||||
disabled: "&7Disabled&e"
|
||||
@ -196,28 +196,28 @@ messages:
|
||||
buy-and-sell-disabled: "&cYou can't create a shop with buying and selling disabled."
|
||||
|
||||
# Set the message when the player successfully bought something.
|
||||
# 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."
|
||||
# Usable regex: %AMOUNT%, %ITEMNAME%, %BUY-PRICE%, %VENDOR%
|
||||
buy-success: "&aYou bought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a from &6%VENDOR%&a."
|
||||
|
||||
# Set the message when the player successfully bought something from an admin shop.
|
||||
# Usable regex: %AMOUNT%, %ITEMNAME%, %BUY-PRICE%, %CURRENCY-SYMBOL%
|
||||
buy-success-admin: "&aYou bought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%%CURRENCY-SYMBOL%&a."
|
||||
# Usable regex: %AMOUNT%, %ITEMNAME%, %BUY-PRICE%
|
||||
buy-success-admin: "&aYou bought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a."
|
||||
|
||||
# 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."
|
||||
# Usable regex: %AMOUNT%, %ITEMNAME%, %SELL-PRICE%, %VENDOR%
|
||||
sell-success: "&aYou sold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&a to &6%VENDOR%&a."
|
||||
|
||||
# Set the message when the player successfully sold something to an admin shop.
|
||||
# Usable regex: %AMOUNT%, %ITEMNAME%, %SELL-PRICE%, %CURRENCY-SYMBOL%
|
||||
sell-success-admin: "&aYou sold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%%CURRENCY-SYMBOL%&a."
|
||||
# Usable regex: %AMOUNT%, %ITEMNAME%, %SELL-PRICE%
|
||||
sell-success-admin: "&aYou sold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&a."
|
||||
|
||||
# Set the message when a player bought something from the player's 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."
|
||||
# Usable regex: %AMOUNT%, %ITEMNAME%, %BUY-PRICE%, %PLAYER%
|
||||
someone-bought: "&6%PLAYER% &abought &6%AMOUNT% x %ITEMNAME%&a for &6%BUY-PRICE%&a from your shop."
|
||||
|
||||
# Set the message when a player sold something to the player's 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."
|
||||
# Usable regex: %AMOUNT%, %ITEMNAME%, %SELL-PRICE%, %PLAYER%
|
||||
someone-sold: "&6%PLAYER% &asold &6%AMOUNT% x %ITEMNAME%&a for &6%SELL-PRICE%&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."
|
||||
@ -267,12 +267,12 @@ messages:
|
||||
cannot-sell-broken-item: "&cYou can't sell a broken item."
|
||||
|
||||
# Set the message when the entered buy price is below the minimum price.
|
||||
# Usable regex: %MIN-PRICE%, %CURRENCY-SYMBOL%
|
||||
buy-price-too-low: "&cThe buy price must be higher than %MIN-PRICE%%CURRENCY-SYMBOL%."
|
||||
# Usable regex: %MIN-PRICE%
|
||||
buy-price-too-low: "&cThe buy price must be higher than %MIN-PRICE%."
|
||||
|
||||
# Set the message when the entered sell price is below the minimum price.
|
||||
# Usable regex: %MIN-PRICE%, %CURRENCY-SYMBOL%
|
||||
sell-price-too-low: "&cThe sell price must be higher than %MIN-PRICE%%CURRENCY-SYMBOL%."
|
||||
# Usable regex: %MIN-PRICE%
|
||||
sell-price-too-low: "&cThe sell price must be higher than %MIN-PRICE%."
|
||||
|
||||
# Set the message when buying is disabled at the shop.
|
||||
buying-disabled: "&cBuying is disabled at this shop."
|
||||
@ -320,16 +320,16 @@ messages:
|
||||
format: "%AMOUNT% * %ITEMNAME%"
|
||||
|
||||
# Set the text in the second row of the shop's hologram when the player can buy and sell an item.
|
||||
# Usable regex: %BUY-PRICE%, %SELL-PRICE%, %CURRENCY-SYMBOL%
|
||||
buy-and-sell: "Buy %BUY-PRICE%%CURRENCY-SYMBOL% | %SELL-PRICE%%CURRENCY-SYMBOL% Sell"
|
||||
# Usable regex: %BUY-PRICE%, %SELL-PRICE%
|
||||
buy-and-sell: "Buy %BUY-PRICE% | %SELL-PRICE% Sell"
|
||||
|
||||
# Set the text in the second row of the shop's hologram when the player can only buy an item.
|
||||
# Usable regex: %BUY-PRICE%, %CURRENCY-SYMBOL%
|
||||
only-buy: "Buy %BUY-PRICE%%CURRENCY-SYMBOL%"
|
||||
# Usable regex: %BUY-PRICE%
|
||||
only-buy: "Buy %BUY-PRICE%"
|
||||
|
||||
# Set the text in the second row of the shop's hologram when the player can only sell an item.
|
||||
# Usable regex: %SELL-PRICE%, %CURRENCY-SYMBOL%
|
||||
only-sell: "Sell %SELL-PRICE%%CURRENCY-SYMBOL%"
|
||||
# Usable regex: %SELL-PRICE%
|
||||
only-sell: "Sell %SELL-PRICE%"
|
||||
|
||||
no-permission:
|
||||
|
||||
|
@ -88,10 +88,6 @@ public class Config {
|
||||
return plugin.getConfig().getString("main-command-name");
|
||||
}
|
||||
|
||||
public static String currency_symbol() {
|
||||
return plugin.getConfig().getString("currency-symbol").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String shop_created() {
|
||||
return plugin.getConfig().getString("messages.shop-created").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
@ -273,7 +269,7 @@ public class Config {
|
||||
}
|
||||
|
||||
public static String shop_create_not_enough_money(double creationPrice) {
|
||||
return plugin.getConfig().getString("messages.shop-create-not-enough-money").replace(Regex.creationPrice, getPriceString(creationPrice)).replace(Regex.currencySymbol, currency_symbol()).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.shop-create-not-enough-money").replace(Regex.creationPrice, getPriceString(creationPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String limit_reached(int limit) {
|
||||
@ -289,11 +285,11 @@ public class Config {
|
||||
}
|
||||
|
||||
public static String buyPrice_too_low(double minPrice) {
|
||||
return plugin.getConfig().getString("messages.buy-price-too-low").replace(Regex.minPrice, getPriceString(minPrice)).replace(Regex.currencySymbol, currency_symbol()).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.buy-price-too-low").replace(Regex.minPrice, getPriceString(minPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String sellPrice_too_low(double minPrice) {
|
||||
return plugin.getConfig().getString("messages.sell-price-too-low").replace(Regex.minPrice, getPriceString(minPrice)).replace(Regex.currencySymbol, currency_symbol()).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.sell-price-too-low").replace(Regex.minPrice, getPriceString(minPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String update_available(String version) {
|
||||
@ -305,15 +301,15 @@ public class Config {
|
||||
}
|
||||
|
||||
public static String hologram_buy_sell(double buyPrice, double sellPrice) {
|
||||
return plugin.getConfig().getString("messages.hologram.buy-and-sell").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.buyPrice, getPriceString(buyPrice)).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.hologram.buy-and-sell").replace(Regex.buyPrice, getPriceString(buyPrice)).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String hologram_buy(double buyPrice) {
|
||||
return plugin.getConfig().getString("messages.hologram.only-buy").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.buyPrice, getPriceString(buyPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.hologram.only-buy").replace(Regex.buyPrice, getPriceString(buyPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String hologram_sell(double sellPrice) {
|
||||
return plugin.getConfig().getString("messages.hologram.only-sell").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.hologram.only-sell").replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String error_occurred(String error) {
|
||||
@ -338,38 +334,38 @@ public class Config {
|
||||
|
||||
public static String shopInfo_price(double buyPrice, double sellPrice) {
|
||||
if ((buyPrice <= 0) && (sellPrice > 0)) {
|
||||
return plugin.getConfig().getString("messages.shop-info.price").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.buyPrice + currency_symbol(), disabled()).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.shop-info.price").replace(Regex.buyPrice, disabled()).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
} else if ((sellPrice <= 0) && (buyPrice > 0)) {
|
||||
return plugin.getConfig().getString("messages.shop-info.price").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.buyPrice, getPriceString(buyPrice)).replace(Regex.sellPrice + currency_symbol(), disabled()).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.shop-info.price").replace(Regex.buyPrice, getPriceString(buyPrice)).replace(Regex.sellPrice, disabled()).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
} else if ((sellPrice > 0) && (buyPrice > 0)) {
|
||||
return plugin.getConfig().getString("messages.shop-info.price").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.buyPrice, getPriceString(buyPrice)).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.shop-info.price").replace(Regex.buyPrice, getPriceString(buyPrice)).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
} else {
|
||||
return plugin.getConfig().getString("messages.shop-info.price").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.buyPrice + currency_symbol(), disabled()).replace(Regex.sellPrice + currency_symbol(), disabled()).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.shop-info.price").replace(Regex.buyPrice, disabled()).replace(Regex.sellPrice, disabled()).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
}
|
||||
|
||||
public static String buy_success(int amount, String itemName, double buyPrice, String vendor) {
|
||||
return plugin.getConfig().getString("messages.buy-success").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.buyPrice, getPriceString(buyPrice)).replace(Regex.vendor, vendor).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.buy-success").replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.buyPrice, getPriceString(buyPrice)).replace(Regex.vendor, vendor).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String buy_success_admin(int amount, String itemName, double buyPrice) {
|
||||
return plugin.getConfig().getString("messages.buy-success-admin").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.buyPrice, getPriceString(buyPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.buy-success-admin").replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.buyPrice, getPriceString(buyPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String sell_success(int amount, String itemName, double sellPrice, String vendor) {
|
||||
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, getPriceString(sellPrice)).replace(Regex.vendor, vendor).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.sell-success").replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.sellPrice, getPriceString(sellPrice)).replace(Regex.vendor, vendor).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String sell_success_admin(int amount, String itemName, double sellPrice) {
|
||||
return plugin.getConfig().getString("messages.sell-success-admin").replace(Regex.currencySymbol, currency_symbol()).replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.sell-success-admin").replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.sellPrice, getPriceString(sellPrice)).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String someone_bought(int amount, String itemName, double buyPrice, 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.buyPrice, getPriceString(buyPrice)).replace(Regex.player, player).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.someone-bought").replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.buyPrice, getPriceString(buyPrice)).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,getPriceString(sellPrice)).replace(Regex.player, player).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
return plugin.getConfig().getString("messages.someone-sold").replace(Regex.amount, String.valueOf(amount)).replace(Regex.itemName, itemName).replace(Regex.sellPrice, getPriceString(sellPrice)).replace(Regex.player, player).replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");
|
||||
}
|
||||
|
||||
public static String occupied_shop_slots(int limit, int amount) {
|
||||
@ -381,20 +377,6 @@ public class Config {
|
||||
}
|
||||
|
||||
private static String getPriceString(double price) {
|
||||
String sPrice = String.valueOf(price);
|
||||
|
||||
if (sPrice.contains(".")) {
|
||||
String cents = sPrice.split("\\.")[1];
|
||||
|
||||
if (cents.length() == 1) {
|
||||
if (cents.equals("0")) {
|
||||
sPrice = sPrice.split("\\.")[0];
|
||||
} else {
|
||||
sPrice = sPrice + "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sPrice;
|
||||
return ShopChest.econ.format(price);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ public class Regex {
|
||||
public static String amount = "%AMOUNT%";
|
||||
public static String itemName = "%ITEMNAME%";
|
||||
public static String creationPrice = "%CREATION-PRICE%";
|
||||
public static String currencySymbol = "%CURRENCY-SYMBOL%";
|
||||
public static String error = "%ERROR%";
|
||||
public static String enchantment = "%ENCHANTMENT%";
|
||||
public static String minPrice = "%MIN-PRICE%";
|
||||
|
Loading…
Reference in New Issue
Block a user