diff --git a/gradle.properties b/gradle.properties index fd59462..c7765f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,5 +2,5 @@ name=EconomyLite owner=Flibio inceptionYear=2015 currentYear=2016 -version=2.2.5 +version=2.2.6 apiVersion=4.1.0-SNAPSHOT diff --git a/src/main/java/io/github/flibio/economylite/impl/economy/account/LiteUniqueAccount.java b/src/main/java/io/github/flibio/economylite/impl/economy/account/LiteUniqueAccount.java index 8598513..58f1b20 100644 --- a/src/main/java/io/github/flibio/economylite/impl/economy/account/LiteUniqueAccount.java +++ b/src/main/java/io/github/flibio/economylite/impl/economy/account/LiteUniqueAccount.java @@ -166,7 +166,10 @@ public TransactionResult deposit(Currency currency, BigDecimal amount, Cause cau public TransactionResult withdraw(Currency currency, BigDecimal amount, Cause cause, Set contexts) { BigDecimal newBal = getBalance(currency).subtract(amount); // Check if the new balance is in bounds - if (newBal.compareTo(BigDecimal.ZERO) == -1 || newBal.compareTo(BigDecimal.valueOf(999999999)) == 1) { + if (newBal.compareTo(BigDecimal.ZERO) == -1) { + return resultAndEvent(this, amount, currency, ResultType.ACCOUNT_NO_FUNDS, TransactionTypes.WITHDRAW); + } + if (newBal.compareTo(BigDecimal.valueOf(999999999)) == 1) { return resultAndEvent(this, amount, currency, ResultType.ACCOUNT_NO_SPACE, TransactionTypes.WITHDRAW); } if (playerService.withdraw(uuid, amount, currency, cause)) { diff --git a/src/main/java/io/github/flibio/economylite/impl/economy/account/LiteVirtualAccount.java b/src/main/java/io/github/flibio/economylite/impl/economy/account/LiteVirtualAccount.java index 9c4f446..494c742 100644 --- a/src/main/java/io/github/flibio/economylite/impl/economy/account/LiteVirtualAccount.java +++ b/src/main/java/io/github/flibio/economylite/impl/economy/account/LiteVirtualAccount.java @@ -153,7 +153,10 @@ public TransactionResult deposit(Currency currency, BigDecimal amount, Cause cau public TransactionResult withdraw(Currency currency, BigDecimal amount, Cause cause, Set contexts) { BigDecimal newBal = getBalance(currency).subtract(amount); // Check if the new balance is in bounds - if (newBal.compareTo(BigDecimal.ZERO) == -1 || newBal.compareTo(BigDecimal.valueOf(999999999)) == 1) { + if (newBal.compareTo(BigDecimal.ZERO) == -1) { + return resultAndEvent(this, amount, currency, ResultType.ACCOUNT_NO_FUNDS, TransactionTypes.WITHDRAW); + } + if (newBal.compareTo(BigDecimal.valueOf(999999999)) == 1) { return resultAndEvent(this, amount, currency, ResultType.ACCOUNT_NO_SPACE, TransactionTypes.WITHDRAW); } if (virtualService.withdraw(name, amount, currency, cause)) {