Refactored usage of some methods
This commit is contained in:
parent
12c45c5e84
commit
e31e6eca88
@ -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 + ""));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user