Introduced Brigadier Command System. More Formatting Coming in next commit.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.massivecraft.factions.cmd.econ;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
@@ -16,36 +18,30 @@ public class CmdMoneyBalance extends FCommand {
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
this.isMoneyCommand = true;
|
||||
|
||||
this.permission = Permission.MONEY_BALANCE.node;
|
||||
this.setHelpShort(TL.COMMAND_MONEYBALANCE_SHORT.toString());
|
||||
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
this.requirements = new CommandRequirements.Builder(Permission.MONEY_BALANCE).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
Faction faction = myFaction;
|
||||
if (this.argIsSet(0)) {
|
||||
faction = this.argAsFaction(0);
|
||||
public void perform(CommandContext context) {
|
||||
Faction faction = context.faction;
|
||||
if (context.argIsSet(0)) {
|
||||
faction = context.argAsFaction(0);
|
||||
}
|
||||
|
||||
if (faction == null) {
|
||||
return;
|
||||
}
|
||||
if (faction != myFaction && !Permission.MONEY_BALANCE_ANY.has(sender, true)) {
|
||||
if (faction != context.faction && !Permission.MONEY_BALANCE_ANY.has(context.sender, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fme != null) {
|
||||
Econ.sendBalanceInfo((CommandSender) fme, faction);
|
||||
if (context.fPlayer != null) {
|
||||
Econ.sendBalanceInfo((CommandSender) context.fPlayer, faction);
|
||||
} else {
|
||||
Econ.sendBalanceInfo(sender, faction);
|
||||
Econ.sendBalanceInfo(context.sender, faction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user