Merge branch 'banks' of git://github.com/eXeC64/Factions

This commit is contained in:
Brettflan
2011-10-01 03:45:28 -05:00
15 changed files with 378 additions and 26 deletions

View File

@@ -253,19 +253,40 @@ public class FBaseCommand {
String desc = this.helpDescription.toLowerCase();
Faction faction = me.getFaction();
// pay up
if (cost > 0.0) {
String costString = Econ.moneyString(cost);
if (!Econ.deductMoney(me.getName(), cost)) {
sendMessage("It costs "+costString+" to "+desc+", which you can't currently afford.");
return false;
if(Conf.bankFactionPaysCosts && me.hasFaction() ) {
if(!faction.removeMoney(cost)) {
sendMessage("It costs "+costString+" to "+desc+", which your faction can't currently afford.");
return false;
} else {
sendMessage(faction.getTag()+" has paid "+costString+" to "+desc+".");
}
} else {
if (!Econ.deductMoney(me.getName(), cost)) {
sendMessage("It costs "+costString+" to "+desc+", which you can't currently afford.");
return false;
}
sendMessage("You have paid "+costString+" to "+desc+".");
}
sendMessage("You have paid "+costString+" to "+desc+".");
}
// wait... we pay you to use this command?
else {
String costString = Econ.moneyString(-cost);
Econ.addMoney(me.getName(), -cost);
if(Conf.bankFactionPaysCosts && me.hasFaction() ) {
faction.addMoney(-cost);
sendMessage(faction.getTag()+" has been paid "+costString+" to "+desc+".");
} else {
Econ.addMoney(me.getName(), -cost);
}
sendMessage("You have been paid "+costString+" to "+desc+".");
}
return true;