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,45 +10,26 @@ public class CmdTitle extends FCommand {
public CmdTitle() {
this.aliases.add("title");
this.requiredArgs.add("player name");
this.optionalArgs.put("title", "");
this.permission = Permission.TITLE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
this.requirements = new CommandRequirements.Builder(Permission.TITLE)
.playerOnly()
.build();
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) {
return;
}
args.remove(0);
String title = TextUtil.implode(args, " ");
title = title.replaceAll(",", "");
if (!canIAdministerYou(fme, you)) {
return;
}
public void perform(CommandContext context) {
FPlayer you = context.argAsBestFPlayerMatch(0);
if (you == null) return;
context.args.remove(0);
String title = TextUtil.implode(context.args, " ");
if (!context.canIAdministerYou(context.fPlayer, you)) return;
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) {
return;
}
you.setTitle(sender, title);
if (!context.payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) return;
you.setTitle(context.sender, title);
// Inform
myFaction.msg(TL.COMMAND_TITLE_CHANGED, fme.describeTo(myFaction, true), you.describeTo(myFaction, true));
context.faction.msg(TL.COMMAND_TITLE_CHANGED, context.fPlayer.describeTo(context.faction, true), you.describeTo(context.faction, true));
}
@Override
@@ -56,4 +37,4 @@ public class CmdTitle extends FCommand {
return TL.COMMAND_TITLE_DESCRIPTION;
}
}
}