Add null check before toggling scoreboard.
This commit is contained in:
parent
ffa7872145
commit
c3452c97aa
@ -38,8 +38,13 @@ public class CmdSB extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
boolean toggle = toggle(me.getPlayer().getUniqueId());
|
||||
FScoreboard.get(fme).setSidebarVisibility(toggle);
|
||||
me.sendMessage(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggle)));
|
||||
FScoreboard board = FScoreboard.get(fme);
|
||||
if(board == null) {
|
||||
me.sendMessage(TL.COMMAND_TOGGLESB_DISABLED.toString());
|
||||
} else {
|
||||
me.sendMessage(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggle)));
|
||||
board.setSidebarVisibility(toggle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -473,6 +473,8 @@ public enum TL {
|
||||
COMMAND_TOGGLEALLIANCECHAT_IGNORE("Alliance chat is now ignored"),
|
||||
COMMAND_TOGGLEALLIANCECHAT_UNIGNORE("Alliance chat is no longer ignored"),
|
||||
|
||||
COMMAND_TOGGLESB_DISABLED("You can't toggle scoreboards while they are disabled."),
|
||||
|
||||
COMMAND_TOP_DESCRIPTION("Sort Factions to see the top of some criteria."),
|
||||
COMMAND_TOP_TOP("Top Factions by %s. Page %d/%d"),
|
||||
COMMAND_TOP_LINE("%d. &6%s: &c%s"), // Rank. Faction: Value
|
||||
|
Loading…
Reference in New Issue
Block a user