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

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