2014-08-05 17:17:27 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
2014-10-16 03:58:37 +02:00
|
|
|
import com.massivecraft.factions.scoreboards.FScoreboard;
|
2014-08-05 17:17:27 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
|
|
|
|
|
|
|
public class CmdSB extends FCommand {
|
|
|
|
|
2019-12-02 19:55:38 +01:00
|
|
|
/**
|
|
|
|
* @author FactionsUUID Team
|
|
|
|
*/
|
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
public CmdSB() {
|
2020-01-02 02:59:31 +01:00
|
|
|
this.aliases.addAll(Aliases.scoreboard);
|
2019-09-14 21:13:01 +02:00
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
this.requirements = new CommandRequirements.Builder(Permission.SCOREBOARD)
|
|
|
|
.playerOnly()
|
|
|
|
.build();
|
|
|
|
}
|
2014-08-05 17:17:27 +02:00
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
@Override
|
|
|
|
public void perform(CommandContext context) {
|
|
|
|
boolean toggleTo = !context.fPlayer.showScoreboard();
|
|
|
|
FScoreboard board = FScoreboard.get(context.fPlayer);
|
|
|
|
if (board == null) {
|
|
|
|
context.msg(TL.COMMAND_TOGGLESB_DISABLED.toString());
|
|
|
|
} else {
|
|
|
|
context.msg(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggleTo)));
|
|
|
|
board.setSidebarVisibility(toggleTo);
|
|
|
|
}
|
|
|
|
context.fPlayer.setShowScoreboard(toggleTo);
|
|
|
|
}
|
2015-01-22 00:58:33 +01:00
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_SCOREBOARD_DESCRIPTION;
|
|
|
|
}
|
2019-09-14 21:13:01 +02:00
|
|
|
}
|