mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-26 12:22:24 +00:00
Display "Disabled" instead of 0$ when selling/buying is disabled
This commit is contained in:
parent
da772fcbd6
commit
c9a63c7cbb
@ -1109,8 +1109,10 @@ public class LanguageUtils {
|
||||
Regex regex = replacedRegex.getRegex();
|
||||
String toReplace = replacedRegex.getReplace();
|
||||
if (regex == Regex.BUY_PRICE || regex == Regex.SELL_PRICE || regex == Regex.MIN_PRICE || regex == Regex.CREATION_PRICE) {
|
||||
double price = Double.parseDouble(toReplace);
|
||||
toReplace = plugin.getEconomy().format(price);
|
||||
if (!toReplace.equals(getMessage(LocalizedMessage.Message.SHOP_INFO_DISABLED))) {
|
||||
double price = Double.parseDouble(toReplace);
|
||||
toReplace = plugin.getEconomy().format(price);
|
||||
}
|
||||
}
|
||||
_message = _message.replace(regex.getName(), toReplace);
|
||||
usedRegexes.add(regex);
|
||||
|
@ -346,8 +346,9 @@ public class ShopInteractListener implements Listener {
|
||||
String enchantmentString = "";
|
||||
String potionEffectString = "";
|
||||
String musicDiscName = LanguageUtils.getMusicDiscName(type);
|
||||
String price = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_PRICE, new LocalizedMessage.ReplacedRegex(Regex.BUY_PRICE, String.valueOf(shop.getBuyPrice())),
|
||||
new LocalizedMessage.ReplacedRegex(Regex.SELL_PRICE, String.valueOf(shop.getSellPrice())));
|
||||
String disabled = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_DISABLED);
|
||||
String price = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_PRICE, new LocalizedMessage.ReplacedRegex(Regex.BUY_PRICE, (shop.getBuyPrice() > 0 ? String.valueOf(shop.getBuyPrice()) : disabled)),
|
||||
new LocalizedMessage.ReplacedRegex(Regex.SELL_PRICE, (shop.getSellPrice() > 0 ? String.valueOf(shop.getSellPrice()) : disabled)));
|
||||
String shopType = LanguageUtils.getMessage(shop.getShopType() == ShopType.NORMAL ? LocalizedMessage.Message.SHOP_INFO_NORMAL : LocalizedMessage.Message.SHOP_INFO_ADMIN);
|
||||
String stock = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_STOCK, new LocalizedMessage.ReplacedRegex(Regex.AMOUNT, String.valueOf(amount)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user