Refactored usage of some methods

This commit is contained in:
ProSavage 2018-08-28 21:07:27 -05:00
parent 12c45c5e84
commit e31e6eca88

View File

@ -344,21 +344,10 @@ public class FUpgradesGUI implements Listener {
} }
private boolean hasMoney(FPlayer fme, int amt) { private boolean hasMoney(FPlayer fme, int amt) {
Economy econ = P.p.getEcon(); return fme.hasMoney(amt);
if (econ.getBalance(fme.getPlayer()) >= amt) {
return true;
} else {
fme.getPlayer().closeInventory();
fme.msg(TL.COMMAND_UPGRADES_NOTENOUGHMONEY);
return false;
}
} }
private void takeMoney(FPlayer fme, int amt) { private void takeMoney(FPlayer fme, int amt) {
if (hasMoney(fme, amt)) { fme.takeMoney(amt);
Economy econ = P.p.getEcon();
econ.withdrawPlayer(fme.getPlayer(), amt);
fme.sendMessage(TL.COMMAND_UPGRADES_MONEYTAKE.toString().replace("{amount}", amt + ""));
}
} }
} }