Bugfixes and awesome probably complete money commands.
This commit is contained in:
@@ -6,17 +6,16 @@ import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdMoneyWithdraw extends FCommand
|
||||
{
|
||||
|
||||
public CmdMoneyWithdraw()
|
||||
{
|
||||
this.aliases.add("w");
|
||||
this.aliases.add("withdraw");
|
||||
|
||||
this.requiredArgs.add("amount");
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
this.permission = Permission.MONEY_WITHDRAW.node;
|
||||
this.isMoneyCommand = true;
|
||||
this.isBankCommand = true;
|
||||
this.setHelpShort("withdraw money");
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
@@ -27,47 +26,9 @@ public class CmdMoneyWithdraw extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
double amount = this.argAsDouble(0, 0);
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
Faction faction = this.argAsFaction(1, myFaction);
|
||||
if (faction == null) return;
|
||||
Econ.transferMoney(fme, faction, fme, amount);
|
||||
|
||||
/*if ( ! Conf.bankMembersCanWithdraw && ! assertMinRole(Role.MODERATOR))
|
||||
{
|
||||
msg("<b>Only faction moderators or admins are able to withdraw from the bank.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction faction = myFaction;
|
||||
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
|
||||
if( amount > 0.0 )
|
||||
{
|
||||
String amountString = Econ.moneyString(amount);
|
||||
|
||||
if( amount > faction.getMoney() )
|
||||
{
|
||||
amount = faction.getMoney();
|
||||
}
|
||||
|
||||
// TODO: Improve messages.
|
||||
|
||||
faction.removeMoney(amount);
|
||||
Econ.addMoney(fme.getName(), amount);
|
||||
msg("<i>You have withdrawn "+amountString+" from "+faction.getTag()+"'s bank.");
|
||||
msg("<i>"+faction.getTag()+" now has "+Econ.moneyString(faction.getMoney()));
|
||||
P.p.log(fme.getName() + " withdrew "+amountString+" from "+faction.getTag()+"'s bank.");
|
||||
|
||||
// TODO: FAction.getOnlineMembers().
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
if (fplayer.getFaction() == faction)
|
||||
{
|
||||
fplayer.msg("%s<i> has withdrawn %s", fme.getNameAndRelevant(fplayer), amountString);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user