Format money in rewards prompt, per #1719

This commit is contained in:
PikaMug 2021-06-18 16:55:45 -04:00
parent f341bc0e79
commit ea8b8fe24b

View File

@ -191,9 +191,8 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final int moneyRew = (Integer) context.getSessionData(CK.REW_MONEY);
return ChatColor.GRAY + "(" + ChatColor.AQUA + moneyRew + " "
+ (moneyRew > 1 ? plugin.getDependencies().getCurrency(true)
: plugin.getDependencies().getCurrency(false)) + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + moneyRew + " "
+ plugin.getDependencies().getVaultEconomy().format(moneyRew) + ChatColor.GRAY + ")";
}
} else {
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
@ -490,16 +489,14 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
@Override
public String getPromptText(final ConversationContext context) {
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
final QuestsEditorPostOpenStringPromptEvent event
= new QuestsEditorPostOpenStringPromptEvent(context, this);
context.getPlugin().getServer().getPluginManager().callEvent(event);
String text = getQueryText(context);
if (plugin.getDependencies().getVaultEconomy() != null) {
text = text.replace("<money>", ChatColor.AQUA + (plugin.getDependencies().getVaultEconomy()
.currencyNamePlural().isEmpty() ? Lang.get("money") : plugin.getDependencies().getVaultEconomy()
.currencyNamePlural()) + ChatColor.YELLOW);
} else {
text = text.replace("<money>", ChatColor.AQUA + Lang.get("money") + ChatColor.YELLOW);
text = text.replace("<money>", ChatColor.AQUA
+ (plugin.getDependencies().getVaultEconomy().currencyNamePlural() + ChatColor.YELLOW));
}
return ChatColor.YELLOW + text;
}