Refactor scoreboard usage
In preparation for team colors, we need to unify scoreboard usage into a single scoreboard per player. Rather than creating a new scoreboard for each desired sidebar objective, we provide an interface FSidebarProvider that allows implementation-agnostic retrieval of the title and lines of the desired sidebar, along with appropriate methods in the new implementation of FScoreboard. The new FScoreboard implementation manages the currently-visible sidebar, with methods to set default (non-timed, with update interval) and temporary (timed, no update interval) sidebars. Temporary sidebars are replaced with the default sidebar upon expiration.
This commit is contained in:
@@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.scoreboards.FDefaultBoard;
|
||||
import com.massivecraft.factions.scoreboards.FScoreboard;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
@@ -39,12 +38,7 @@ public class CmdSB extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
boolean toggle = toggle(me.getPlayer().getUniqueId());
|
||||
if(!toggle && fme.getActiveBoard() != null) {
|
||||
fme.getActiveBoard().cancel();
|
||||
} else if(toggle && P.p.getConfig().getBoolean("scoreboards.default-enabled", true)){
|
||||
FScoreboard board = new FDefaultBoard(fme);
|
||||
fme.setActiveBoard(board);
|
||||
}
|
||||
FScoreboard.get(fme).setSidebarVisibility(toggle);
|
||||
me.sendMessage(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggle)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user