mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-10 04:31:06 +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();
|
Regex regex = replacedRegex.getRegex();
|
||||||
String toReplace = replacedRegex.getReplace();
|
String toReplace = replacedRegex.getReplace();
|
||||||
if (regex == Regex.BUY_PRICE || regex == Regex.SELL_PRICE || regex == Regex.MIN_PRICE || regex == Regex.CREATION_PRICE) {
|
if (regex == Regex.BUY_PRICE || regex == Regex.SELL_PRICE || regex == Regex.MIN_PRICE || regex == Regex.CREATION_PRICE) {
|
||||||
double price = Double.parseDouble(toReplace);
|
if (!toReplace.equals(getMessage(LocalizedMessage.Message.SHOP_INFO_DISABLED))) {
|
||||||
toReplace = plugin.getEconomy().format(price);
|
double price = Double.parseDouble(toReplace);
|
||||||
|
toReplace = plugin.getEconomy().format(price);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_message = _message.replace(regex.getName(), toReplace);
|
_message = _message.replace(regex.getName(), toReplace);
|
||||||
usedRegexes.add(regex);
|
usedRegexes.add(regex);
|
||||||
|
@ -346,8 +346,9 @@ public class ShopInteractListener implements Listener {
|
|||||||
String enchantmentString = "";
|
String enchantmentString = "";
|
||||||
String potionEffectString = "";
|
String potionEffectString = "";
|
||||||
String musicDiscName = LanguageUtils.getMusicDiscName(type);
|
String musicDiscName = LanguageUtils.getMusicDiscName(type);
|
||||||
String price = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_PRICE, new LocalizedMessage.ReplacedRegex(Regex.BUY_PRICE, String.valueOf(shop.getBuyPrice())),
|
String disabled = LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_INFO_DISABLED);
|
||||||
new LocalizedMessage.ReplacedRegex(Regex.SELL_PRICE, String.valueOf(shop.getSellPrice())));
|
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 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)));
|
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