From ae1b9cf95e511decd352adbafe75e23726dd68c6 Mon Sep 17 00:00:00 2001 From: tjtanjin Date: Sat, 3 Feb 2024 00:56:46 +0800 Subject: [PATCH] fix: Fix an issue where claimblocks were not calculated properly --- pom.xml | 2 +- .../java/tk/taverncraft/quicktax/utils/TaxManager.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 6633925..7a50b5a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ quicktax quicktax - 1.6.0 + 1.7.0 QuickTax diff --git a/src/main/java/tk/taverncraft/quicktax/utils/TaxManager.java b/src/main/java/tk/taverncraft/quicktax/utils/TaxManager.java index 94295c7..c974628 100644 --- a/src/main/java/tk/taverncraft/quicktax/utils/TaxManager.java +++ b/src/main/java/tk/taverncraft/quicktax/utils/TaxManager.java @@ -376,11 +376,12 @@ public class TaxManager { try { PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId()); + double totalClaims = playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks(); double playerClaims; if (main.getConfig().getBoolean("active-claims-only", false)) { - playerClaims = playerData.getAccruedClaimBlocks() - playerData.getRemainingClaimBlocks(); + playerClaims = totalClaims - playerData.getRemainingClaimBlocks(); } else { - playerClaims = playerData.getAccruedClaimBlocks(); + playerClaims = totalClaims; } subtractAmount = getSubtractAmountWithClaims(player, usePercentage, balTaxAmount, playerBal, claimsTaxAmount, playerClaims); } catch (NoClassDefFoundError e) { @@ -403,7 +404,7 @@ public class TaxManager { } MessageManager.sendMessage(player.getPlayer(), "player-pay-tax-success", new String[]{"%player%", "%amount%"}, - new String[]{player.getName(), String.valueOf(subtractAmount)}); + new String[]{player.getName(), new BigDecimal(subtractAmount).setScale(2, RoundingMode.HALF_UP).toPlainString()}); } // needed in rare situations where async access to economy plugin is disallowed @@ -462,7 +463,7 @@ public class TaxManager { } MessageManager.sendMessage(player.getPlayer(), "player-pay-tax-success", new String[]{"%player%", "%amount%"}, - new String[]{player.getName(), String.valueOf(subtractAmount)}); + new String[]{player.getName(), new BigDecimal(subtractAmount).setScale(2, RoundingMode.HALF_UP).toPlainString()}); } // needed in rare situations where async access to economy plugin is disallowed