Fix /plot buy message and enhance it with player balance

This commit is contained in:
N0tMyFaultOG 2020-11-19 16:32:30 +01:00
parent 47cb85d3db
commit 9478251d44
4 changed files with 8 additions and 4 deletions

View File

@ -285,7 +285,8 @@ public class Auto extends SubCommand {
if (!force && this.econHandler.getMoney(player) < cost) {
player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_plot"),
Template.of("money", String.valueOf(cost))
Template.of("money", String.valueOf(cost)),
Template.of("balance", String.valueOf(this.econHandler.getMoney(player)))
);
return true;
}

View File

@ -94,7 +94,9 @@ public class Buy extends Command {
throw new CommandException(TranslatableCaption.of("economy.not_for_sale"));
}
checkTrue(this.econHandler.getMoney(player) >= price,
TranslatableCaption.of("economy.cannot_afford_plot"));
TranslatableCaption.of("economy.cannot_afford_plot"),
Template.of("money", String.valueOf(price)),
Template.of("balance", String.valueOf(this.econHandler.getMoney(player))));
this.econHandler.withdrawMoney(player, price);
// Failure
// Success

View File

@ -147,7 +147,8 @@ public class Claim extends SubCommand {
this.econHandler.withdrawMoney(player, cost);
player.sendMessage(
TranslatableCaption.of("economy.removed_balance"),
Template.of("money", String.valueOf(cost))
Template.of("money", String.valueOf(cost)),
Template.of("balance", String.valueOf(this.econHandler.getMoney(player)))
);
}
}

View File

@ -124,7 +124,7 @@
"tutorial.comment_this": "<prefix><gray>Leave some feedback on this plot: <plot>.</gray>",
"economy.econ_disabled": "<prefix><red>Economy is not enabled.</red>",
"economy.cannot_afford_plot": "<prefix><red>You cannot afford to buy this plot. It costs <gold><money></gold>.</red>",
"economy.cannot_afford_plot": "<prefix><red>You cannot afford to buy this plot. It costs <gold><money></gold>. You have <gold><balance></gold>.</red>",
"economy.not_for_sale": "<prefix><red>This plot is not for sale.</red>",
"economy.cannot_buy_own": "<prefix><red>You cannot buy your own plot.</red>",
"economy.plot_sold": "<prefix><dark_aqua>Your plot; <gold><plot></gold>, has been sold to <gold><player></gold> for <gold><price></gold>.</dark_aqua>",