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

@@ -9,28 +9,21 @@ public class CmdPermanentPower extends FCommand {
public CmdPermanentPower() {
super();
this.aliases.add("permanentpower");
this.requiredArgs.add("faction");
this.requiredArgs.add("power");
this.permission = Permission.SET_PERMANENTPOWER.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
this.requirements = new CommandRequirements.Builder(Permission.SET_PERMANENTPOWER)
.build();
}
@Override
public void perform() {
Faction targetFaction = this.argAsFaction(0);
public void perform(CommandContext context) {
Faction targetFaction = context.argAsFaction(0);
if (targetFaction == null) {
return;
}
Integer targetPower = this.argAsInt(1);
Integer targetPower = context.argAsInt(1);
targetFaction.setPermanentPower(targetPower);
@@ -40,14 +33,14 @@ public class CmdPermanentPower extends FCommand {
}
// Inform sender
msg(TL.COMMAND_PERMANENTPOWER_SUCCESS, change, targetFaction.describeTo(fme));
context.msg(TL.COMMAND_PERMANENTPOWER_SUCCESS, change, targetFaction.describeTo(context.fPlayer));
// Inform all other players
for (FPlayer fplayer : targetFaction.getFPlayersWhereOnline(true)) {
if (fplayer == fme) {
if (fplayer == context.fPlayer) {
continue;
}
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
String blame = (context.fPlayer == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true));
fplayer.msg(TL.COMMAND_PERMANENTPOWER_FACTION, blame, change);
}
}