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,25 +9,27 @@ public class CmdSB extends FCommand {
public CmdSB() {
this.aliases.add("sb");
this.aliases.add("scoreboard");
this.permission = Permission.SCOREBOARD.node;
this.senderMustBePlayer = true;
this.requirements = new CommandRequirements.Builder(Permission.SCOREBOARD)
.playerOnly()
.build();
}
@Override
public void perform() {
boolean toggleTo = !fme.showScoreboard();
FScoreboard board = FScoreboard.get(fme);
public void perform(CommandContext context) {
boolean toggleTo = !context.fPlayer.showScoreboard();
FScoreboard board = FScoreboard.get(context.fPlayer);
if (board == null) {
me.sendMessage(TL.COMMAND_TOGGLESB_DISABLED.toString());
context.msg(TL.COMMAND_TOGGLESB_DISABLED.toString());
} else {
me.sendMessage(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggleTo)));
context.msg(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggleTo)));
board.setSidebarVisibility(toggleTo);
}
fme.setShowScoreboard(toggleTo);
context.fPlayer.setShowScoreboard(toggleTo);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SCOREBOARD_DESCRIPTION;
}
}
}