mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-03 12:31:46 +00:00
Abort transaction before updating funds on balance overflow.
This commit is contained in:
parent
ada2fe01a2
commit
889dde7549
2 changed files with 10 additions and 6 deletions
|
@ -115,17 +115,19 @@ public abstract class UserData extends PlayerExtension implements IConf
|
|||
}
|
||||
|
||||
public void setMoney(BigDecimal value, boolean throwError) throws MaxMoneyException
|
||||
{
|
||||
money = value;
|
||||
{
|
||||
BigDecimal maxMoney = ess.getSettings().getMaxMoney();
|
||||
BigDecimal minMoney = ess.getSettings().getMinMoney();
|
||||
if (money.compareTo(maxMoney) > 0)
|
||||
{
|
||||
money = maxMoney;
|
||||
if (value.compareTo(maxMoney) > 0)
|
||||
{
|
||||
if (throwError)
|
||||
{
|
||||
throw new MaxMoneyException();
|
||||
}
|
||||
money = maxMoney;
|
||||
}
|
||||
else {
|
||||
money = value;
|
||||
}
|
||||
if (money.compareTo(minMoney) < 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue