Display "Disabled" instead of 0$ when selling/buying is disabled

This commit is contained in:
Eric 2016-09-06 11:43:01 +02:00
parent da772fcbd6
commit c9a63c7cbb
2 changed files with 7 additions and 4 deletions

View File

@ -1109,9 +1109,11 @@ 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) {
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);
break;

View File

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