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(); }
public void transferMoney(UUID from, UUID to, double amount) { new Thread( () -> { PlayerData fromData = getData(from); PlayerData toData = getData(to); fromData.creditMoney(-amount); toData.creditMoney(amount); }) .start(); }
public double getAmount(UUID player) { PlayerData data = getData(player); return data.getMoney(); }