@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
OfflinePlayer player = econ.getPlayer(playerName);
if ( player == null ) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player does not exist");
}
double balance = econ.getExp(player);
amount = Math.ceil(amount);
if (amount < 0) {
return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds");
}
if ( econ.hasExp(player, (int) amount) == false ) {
return new EconomyResponse(0, balance, ResponseType.FAILURE, "Insufficient funds");
}
econ.removeExp(player, (int) amount);
double finalBalance = econ.getExp(player);
return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null);
}