Fix empty templates when vault not found

This commit is contained in:
NotMyFault 2021-05-07 01:53:18 +02:00
parent 891230c78e
commit a990205d41
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
4 changed files with 9 additions and 4 deletions

View File

@ -312,13 +312,15 @@ public class Auto extends SubCommand {
player.getPlotCount(plotarea.getWorldName())); player.getPlotCount(plotarea.getWorldName()));
cost = (size_x * size_z) * cost; cost = (size_x * size_z) * cost;
if (cost > 0d) { if (cost > 0d) {
if (!force && this.econHandler.getMoney(player) < cost) { if (!force && this.econHandler.getMoney(player) < cost && this.econHandler.isSupported()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_plot"), TranslatableCaption.of("economy.cannot_afford_plot"),
Template.of("money", this.econHandler.format(cost)), Template.of("money", this.econHandler.format(cost)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
); );
return true; } else {
player.sendMessage(TranslatableCaption.of("economy.vault_not_found"));
return false;
} }
this.econHandler.withdrawMoney(player, cost); this.econHandler.withdrawMoney(player, cost);
player.sendMessage( player.sendMessage(

View File

@ -98,7 +98,7 @@ public class Buy extends Command {
throw new CommandException(TranslatableCaption.of("economy.not_for_sale")); throw new CommandException(TranslatableCaption.of("economy.not_for_sale"));
} }
checkTrue( checkTrue(
this.econHandler.getMoney(player) >= price, this.econHandler.getMoney(player) >= price && this.econHandler.isSupported(),
TranslatableCaption.of("economy.cannot_afford_plot"), TranslatableCaption.of("economy.cannot_afford_plot"),
Template.of("money", this.econHandler.format(price)), Template.of("money", this.econHandler.format(price)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))

View File

@ -151,12 +151,14 @@ public class Claim extends SubCommand {
PlotExpression costExr = area.getPrices().get("claim"); PlotExpression costExr = area.getPrices().get("claim");
double cost = costExr.evaluate(currentPlots); double cost = costExr.evaluate(currentPlots);
if (cost > 0d) { if (cost > 0d) {
if (this.econHandler.getMoney(player) < cost) { if (this.econHandler.getMoney(player) < cost && this.econHandler.isSupported()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_plot"), TranslatableCaption.of("economy.cannot_afford_plot"),
Template.of("money", this.econHandler.format(cost)), Template.of("money", this.econHandler.format(cost)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
); );
} else {
player.sendMessage(TranslatableCaption.of("economy.vault_not_found"));
return false; return false;
} }
this.econHandler.withdrawMoney(player, cost); this.econHandler.withdrawMoney(player, cost);

View File

@ -103,6 +103,7 @@
"tutorial.rate_this": "<prefix><gray>Rate this plot!</gray>", "tutorial.rate_this": "<prefix><gray>Rate this plot!</gray>",
"tutorial.comment_this": "<prefix><gray>Leave some feedback on this plot: <plot>.</gray>", "tutorial.comment_this": "<prefix><gray>Leave some feedback on this plot: <plot>.</gray>",
"economy.econ_disabled": "<prefix><red>Economy is not enabled.</red>", "economy.econ_disabled": "<prefix><red>Economy is not enabled.</red>",
"economy.vault_not_found": "<prefix><red>Vault is not installed. No Vault-like economy service can be provided.</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.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.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.cannot_buy_own": "<prefix><red>You cannot buy your own plot.</red>",