Introduced Brigadier Command System. More Formatting Coming in next commit.

This commit is contained in:
Driftay
2019-09-14 15:13:01 -04:00
parent b06e6e0f04
commit 3c9b606bb9
207 changed files with 4465 additions and 4017 deletions

View File

@@ -1,57 +1,50 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdPaypalSee extends FCommand {
public CmdPaypalSee() {
aliases.add("seepaypal");
aliases.add("paypal");
this.aliases.add("seepaypal");
this.aliases.add("paypal");
optionalArgs.put("faction", "yours");
permission = Permission.PAYPAL.node;
disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = true;
this.optionalArgs.put("faction", "yours");
this.requirements = new CommandRequirements.Builder(Permission.PAYPAL)
.memberOnly()
.build();
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fpaypal.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
public void perform(CommandContext context) {
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fpaypal.Enabled")) {
context.msg(TL.GENERIC_DISABLED);
return;
}
if (args.size() == 0) {
if (myFaction.getPaypal().isEmpty()) {
msg(TL.COMMAND_PAYPAL_NOTSET);
if (context.args.size() == 0) {
if (context.fPlayer.getFaction().getPaypal().isEmpty()) {
context.msg(TL.COMMAND_PAYPAL_NOTSET);
} else {
msg(TL.PAYPALSEE_PLAYER_PAYPAL, myFaction.getPaypal());
context.msg(TL.PAYPALSEE_PLAYER_PAYPAL, context.fPlayer.getFaction().getPaypal());
}
} else if (args.size() == 1) {
if (fme.isAdminBypassing()) {
Faction faction = argAsFaction(0);
} else if (context.args.size() == 1) {
if (context.fPlayer.isAdminBypassing()) {
Faction faction = context.argAsFaction(0);
if (faction != null) {
if (faction.getPaypal().isEmpty()) {
msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET, faction.getTag());
context.msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET, faction.getTag());
} else {
msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
context.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
}
}
} else {
msg(TL.GENERIC_NOPERMISSION, "see another factions paypal.");
context.msg(TL.GENERIC_NOPERMISSION, "see another factions paypal.");
}
} else {
msg(P.p.cmdBase.cmdPaypalSee.getUseageTemplate());
context.msg(FactionsPlugin.getInstance().cmdBase.cmdPaypalSee.getUseageTemplate(context));
}
}