From 9478251d44edc011e1102ecbc965ff640bdc71f0 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Thu, 19 Nov 2020 16:32:30 +0100 Subject: [PATCH] Fix /plot buy message and enhance it with player balance --- Core/src/main/java/com/plotsquared/core/command/Auto.java | 3 ++- Core/src/main/java/com/plotsquared/core/command/Buy.java | 4 +++- Core/src/main/java/com/plotsquared/core/command/Claim.java | 3 ++- Core/src/main/resources/lang/messages_en.json | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Auto.java b/Core/src/main/java/com/plotsquared/core/command/Auto.java index c4cd060f8..c66195d26 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Auto.java +++ b/Core/src/main/java/com/plotsquared/core/command/Auto.java @@ -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; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Buy.java b/Core/src/main/java/com/plotsquared/core/command/Buy.java index c7074abc5..db31c0bdf 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Buy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Buy.java @@ -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 diff --git a/Core/src/main/java/com/plotsquared/core/command/Claim.java b/Core/src/main/java/com/plotsquared/core/command/Claim.java index 8e0ad7815..fb193f155 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Claim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Claim.java @@ -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))) ); } } diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index e0b03fb9e..a2bd1806f 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -124,7 +124,7 @@ "tutorial.comment_this": "Leave some feedback on this plot: .", "economy.econ_disabled": "Economy is not enabled.", - "economy.cannot_afford_plot": "You cannot afford to buy this plot. It costs .", + "economy.cannot_afford_plot": "You cannot afford to buy this plot. It costs . You have .", "economy.not_for_sale": "This plot is not for sale.", "economy.cannot_buy_own": "You cannot buy your own plot.", "economy.plot_sold": "Your plot; , has been sold to for .",