From 8655870077fc1c777916c8155fe00ba1b0c62c7f Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Fri, 15 Oct 2021 15:39:01 +0100 Subject: [PATCH] Add clarifying comment to buy tax bypass --- .../com/Acrobot/ChestShop/Listeners/Economy/TaxModule.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/TaxModule.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/TaxModule.java index 226daeb..e1872d7 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/TaxModule.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/TaxModule.java @@ -18,7 +18,7 @@ import java.util.UUID; */ public class TaxModule implements Listener { private static final String TAX_RECEIVED_MESSAGE = "Applied a tax of %1$f percent (%2$.2f) to the received amount for a resulting price of %3$.2f"; - private static final String TAX_SENT_MESSAGE = "Applied a tax of %1$f percent (%2$.2f) to the sent amount for a resulting price of %3$.2f"; + private static final String TAX_SENT_MESSAGE = "Reduced buy price by tax of %1$f percent (%2$.2f) for a resulting price of %3$.2f as the buyer has the buy tax bypass permission"; private static float getTax(UUID partner) { float taxAmount = NameManager.isAdminShop(partner) || NameManager.isServerEconomyAccount(partner) @@ -60,11 +60,13 @@ public class TaxModule implements Listener { ChestShop.getBukkitLogger().info(String.format(TAX_RECEIVED_MESSAGE, taxAmount, tax, taxedAmount)); } } else if (event.getDirection() == CurrencyTransferEvent.Direction.PARTNER && Permission.has(event.getInitiator(), Permission.NO_BUY_TAX)) { + // Reduce paid amount as the buyer has permission to not pay taxes BigDecimal taxSent = getTaxAmount(event.getAmountSent(), taxAmount); BigDecimal taxedSentAmount = event.getAmountSent().subtract(taxSent); event.setAmountSent(taxedSentAmount); ChestShop.getBukkitLogger().info(String.format(TAX_SENT_MESSAGE, taxAmount, taxSent, taxedSentAmount)); + // Reduce the amount that the seller receives anyways even though tax wasn't paid as that shouldn't make a difference for the seller BigDecimal taxReceived = getTaxAmount(event.getAmountReceived(), taxAmount); BigDecimal taxedReceivedAmount = event.getAmountReceived().subtract(taxReceived); event.setAmountReceived(taxedReceivedAmount);