mirror of
https://github.com/xHyroM/lighteco.git
synced 2024-11-10 01:18:07 +01:00
refactor: cleanup
This commit is contained in:
parent
48807e8a8b
commit
2e20dee652
3 changed files with 4 additions and 9 deletions
|
@ -33,7 +33,7 @@ public class ApiCurrencyManager extends ApiAbstractManager<dev.xhyrom.lighteco.c
|
|||
|
||||
@Override
|
||||
public void registerCurrency(@NonNull Currency currency) {
|
||||
dev.xhyrom.lighteco.common.model.currency.Currency internal = new dev.xhyrom.lighteco.common.model.currency.Currency(plugin, currency);
|
||||
dev.xhyrom.lighteco.common.model.currency.Currency internal = new dev.xhyrom.lighteco.common.model.currency.Currency(currency);
|
||||
this.handler.registerCurrency(internal);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
package dev.xhyrom.lighteco.common.model.currency;
|
||||
|
||||
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
public class Currency {
|
||||
private final LightEcoPlugin plugin;
|
||||
|
||||
@Getter
|
||||
private final dev.xhyrom.lighteco.api.model.currency.Currency proxy;
|
||||
|
||||
public Currency(LightEcoPlugin plugin, dev.xhyrom.lighteco.api.model.currency.Currency proxy) {
|
||||
this.plugin = plugin;
|
||||
public Currency(dev.xhyrom.lighteco.api.model.currency.Currency proxy) {
|
||||
this.proxy = proxy;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import dev.xhyrom.lighteco.api.LightEco;
|
|||
import dev.xhyrom.lighteco.api.LightEcoProvider;
|
||||
import dev.xhyrom.lighteco.api.model.currency.Currency;
|
||||
import dev.xhyrom.lighteco.api.model.user.User;
|
||||
import dev.xhyrom.lighteco.currency.money.bukkit.BukkitMCLoader;
|
||||
import dev.xhyrom.lighteco.currency.money.common.Plugin;
|
||||
import net.milkbowl.vault.economy.AbstractEconomy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
|
@ -13,7 +12,6 @@ import org.bukkit.Bukkit;
|
|||
import java.math.BigDecimal;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Vault extends AbstractEconomy {
|
||||
|
@ -226,6 +224,7 @@ public class Vault extends AbstractEconomy {
|
|||
private double bigDecimalToDouble(final BigDecimal value) {
|
||||
double amount = value.doubleValue();
|
||||
|
||||
// Don't return bigger balance than user actually has
|
||||
if (BigDecimal.valueOf(amount).compareTo(value) > 0) {
|
||||
amount = Math.nextAfter(amount, Double.NEGATIVE_INFINITY);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue