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

@@ -10,37 +10,29 @@ public class CmdSetMaxVaults extends FCommand {
public CmdSetMaxVaults() {
this.aliases.add("setmaxvaults");
this.aliases.add("smv");
this.requiredArgs.add("faction");
this.requiredArgs.add("number");
this.permission = Permission.SETMAXVAULTS.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
this.requirements = new CommandRequirements.Builder(Permission.SETMAXVAULTS)
.build();
}
@Override
public void perform() {
Faction targetFaction = argAsFaction(0);
int value = argAsInt(1, -1);
public void perform(CommandContext context) {
Faction targetFaction = context.argAsFaction(0);
int value = context.argAsInt(1, -1);
if (value < 0) {
sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
context.sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
return;
}
if (targetFaction == null) {
sender.sendMessage(ChatColor.RED + "Couldn't find Faction: " + ChatColor.YELLOW + argAsString(0));
context.sender.sendMessage(ChatColor.RED + "Couldn't find Faction: " + ChatColor.YELLOW + context.argAsString(0));
return;
}
targetFaction.setMaxVaults(value);
sender.sendMessage(TL.COMMAND_SETMAXVAULTS_SUCCESS.format(targetFaction.getTag(), value));
context.sender.sendMessage(TL.COMMAND_SETMAXVAULTS_SUCCESS.format(targetFaction.getTag(), value));
}
@Override