public void withdrawMoneyWithBalanceCheck( TaxPayer payer, double amount, FinancialCallback callback) { new Thread( () -> { if (payer.withdrawMoney(amount)) { if (callback != null) callback.done(payer.getMoney(), amount); } else { if (callback != null) callback.done(payer.getMoney(), 0); } }) .start(); }
public void giveMoney(UUID player, double amount, FinancialCallback callback) { new Thread( () -> { PlayerData data = getData(player); data.creditMoney(amount); if (callback != null) callback.done(data.getMoney(), amount); }) .start(); }