Compare commits

...

2 Commits

Author SHA1 Message Date
Phoenix616 09170f6d51
Add official RedProtect repo and update dependency (Fixes #589) 2024-04-26 17:22:34 +01:00
Phoenix616 488cd2e9d5
Use doubles for tax amount in config instead of int (Fixes #578)
For some reason this already was a float internally but not exposed in the config? Wat.
2024-04-26 16:51:42 +01:00
3 changed files with 12 additions and 8 deletions

View File

@ -49,6 +49,10 @@
<id>NyaaCat</id>
<url>https://ci.nyaacat.com/maven/</url>
</repository>
<repository>
<id>redprotect-repo</id>
<url>https://raw.githubusercontent.com/FabioZumbi12/RedProtect/mvn-repo/</url>
</repository>
</repositories>
<dependencies>
@ -255,13 +259,13 @@
<dependency>
<groupId>br.net.fabiozumbi12.RedProtect</groupId>
<artifactId>RedProtect-Spigot</artifactId>
<version>7.6.2</version>
<version>7.7.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>br.net.fabiozumbi12.RedProtect</groupId>
<artifactId>RedProtect-Core</artifactId>
<version>7.6.2</version>
<version>7.7.3</version>
<scope>provided</scope>
</dependency>

View File

@ -190,10 +190,10 @@ public class Properties {
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);

View File

@ -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 @@ public class TaxModule implements Listener {
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 class TaxModule implements Listener {
return;
}
float taxAmount = getTax(event.getPartner());
double taxAmount = getTax(event.getPartner());
if (taxAmount == 0) {
return;
}