diff --git a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java index 93e0ee66b..dddbf219a 100644 --- a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java +++ b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java @@ -190,10 +190,10 @@ public Object parseToJava(Class type, Object object) { public static UUID SERVER_ECONOMY_ACCOUNT_UUID = new UUID(0, 0); @ConfigurationComment("Percent of the price that should go to the server's account. (100 = 100 percent)") - public static int TAX_AMOUNT = 0; + public static double TAX_AMOUNT = 0; @ConfigurationComment("Percent of the price that should go to the server's account when buying from an Admin Shop.") - public static int SERVER_TAX_AMOUNT = 0; + public static double SERVER_TAX_AMOUNT = 0; @ConfigurationComment("Amount of money player must pay to create a shop") public static BigDecimal SHOP_CREATION_PRICE = BigDecimal.valueOf(0); 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 b4264cb1e..1cfc4871b 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/TaxModule.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/TaxModule.java @@ -20,8 +20,8 @@ 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 = "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) + private static double getTax(UUID partner) { + double taxAmount = NameManager.isAdminShop(partner) || NameManager.isServerEconomyAccount(partner) ? Properties.SERVER_TAX_AMOUNT : Properties.TAX_AMOUNT; if (taxAmount == 0) { @@ -31,7 +31,7 @@ private static float getTax(UUID partner) { return taxAmount; } - private static BigDecimal getTaxAmount(BigDecimal price, float taxAmount) { + private static BigDecimal getTaxAmount(BigDecimal price, double taxAmount) { return price.multiply(BigDecimal.valueOf(taxAmount)).divide(BigDecimal.valueOf(100), Properties.PRICE_PRECISION, BigDecimal.ROUND_HALF_UP); } @@ -41,7 +41,7 @@ public static void onCurrencyTransfer(CurrencyTransferEvent event) { return; } - float taxAmount = getTax(event.getPartner()); + double taxAmount = getTax(event.getPartner()); if (taxAmount == 0) { return; }