private EconomyResponse withdraw(String playerName, String uuid, double amount) {
if (amount < 0) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds");
}
Account account = plugin.getAPI().getAccount(playerName, uuid);
if (account == null) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Account doesn't exist");
}
if (account.has(amount)) {
account.withdraw(amount);
return new EconomyResponse(amount, account.getMoney(), ResponseType.SUCCESS, "");
} else {
return new EconomyResponse(0, account.getMoney(), ResponseType.FAILURE, "Insufficient funds");
}
}