From addb9d4d88126b806b2aee2ee8fcc249aff4a58b Mon Sep 17 00:00:00 2001 From: Isocoram Date: Mon, 31 Aug 2026 23:45:07 +0200 Subject: [PATCH 1/4] Add bounds check for the give method within Commandeco.java. --- .../java/com/earth2me/essentials/commands/Commandeco.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java index c2d68ff2f56..80b58a693a6 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java @@ -55,7 +55,13 @@ public void run(final Server server, final CommandSource sender, final String co switch (cmd) { case GIVE: { - player.giveMoney(userAmount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO); + final BigDecimal serverMaxBal = ess.getSettings().getMaxMoney(); + final BigDecimal postTransactionBal = player.getMoney().add(userAmount); + if (postTransactionBal.compareTo(serverMaxBal) > 0) { + ess.showError(sender, new TranslatableException("maxMoneyError", AdventureUtil.parsed(NumberUtil.displayCurrency(serverMaxBal, ess))), commandLabel); + } else { + player.giveMoney(userAmount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO); + } break; } case TAKE: { From 48b171e571859106c833992cb3d0b53e0dcc6939 Mon Sep 17 00:00:00 2001 From: Isocoram Date: Tue, 1 Sep 2026 00:17:07 +0200 Subject: [PATCH 2/4] Add bounds check for the give method within Commandeco.java. --- .../main/java/com/earth2me/essentials/commands/Commandeco.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java index 80b58a693a6..d7a2d53c87b 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandeco.java @@ -58,7 +58,7 @@ public void run(final Server server, final CommandSource sender, final String co final BigDecimal serverMaxBal = ess.getSettings().getMaxMoney(); final BigDecimal postTransactionBal = player.getMoney().add(userAmount); if (postTransactionBal.compareTo(serverMaxBal) > 0) { - ess.showError(sender, new TranslatableException("maxMoneyError", AdventureUtil.parsed(NumberUtil.displayCurrency(serverMaxBal, ess))), commandLabel); + ess.showError(sender, new TranslatableException("maxMoney", AdventureUtil.parsed(NumberUtil.displayCurrency(serverMaxBal, ess))), commandLabel); } else { player.giveMoney(userAmount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO); } From dadf925afa25baaa32d1f18d40efe0b24b9f781a Mon Sep 17 00:00:00 2001 From: Isocoram Date: Wed, 2 Sep 2026 06:30:31 +0200 Subject: [PATCH 3/4] Fix /pay allowing balance exceeding server's max-money setting --- .../java/com/earth2me/essentials/commands/Commandpay.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java index 84c2722b7a1..0f78c3d06a8 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java @@ -64,7 +64,6 @@ public void run(final Server server, final User user, final String commandLabel, user.sendTl("payOffline"); return; } - if (!player.isAcceptingPay() || (ess.getSettings().isPayExcludesIgnoreList() && player.isIgnoredPlayer(user))) { user.sendTl("notAcceptingPay", player.getDisplayName()); return; @@ -80,6 +79,12 @@ public void run(final Server server, final User user, final String commandLabel, user.getConfirmingPayments().put(player, amount); return; } + final BigDecimal serverMaxBal = ess.getSettings().getMaxMoney(); + final BigDecimal postTransactionBal = player.getMoney().add(amount); + if ((postTransactionBal.compareTo(serverMaxBal) > 0) && !args[0].equals("*")) { + user.sendMessage("§c" + player.getDisplayName() + " would surpass the server's maximum balance limit!"); + return; + } user.payUser(player, amount, UserBalanceUpdateEvent.Cause.COMMAND_PAY); user.getConfirmingPayments().remove(player); Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), user.getMoney(), ess); From 8c474fbe4b0b1fd0096d11b025104451c263b22c Mon Sep 17 00:00:00 2001 From: Isocoram Date: Wed, 2 Sep 2026 06:37:27 +0200 Subject: [PATCH 4/4] Fix /pay allowing balance to exceed server's max-money setting if wildcard is used --- .../java/com/earth2me/essentials/commands/Commandpay.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java index 0f78c3d06a8..60336a033e0 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandpay.java @@ -81,8 +81,10 @@ public void run(final Server server, final User user, final String commandLabel, } final BigDecimal serverMaxBal = ess.getSettings().getMaxMoney(); final BigDecimal postTransactionBal = player.getMoney().add(amount); - if ((postTransactionBal.compareTo(serverMaxBal) > 0) && !args[0].equals("*")) { - user.sendMessage("§c" + player.getDisplayName() + " would surpass the server's maximum balance limit!"); + if (postTransactionBal.compareTo(serverMaxBal) > 0) { + if (!args[0].equals("*")) { + user.sendMessage("§c" + player.getDisplayName() + " would surpass the server's maximum balance limit!"); + } return; } user.payUser(player, amount, UserBalanceUpdateEvent.Cause.COMMAND_PAY);