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:
@@ -6,7 +6,7 @@ import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.iface.RelationParticipator;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.integration.Worldguard;
|
||||
import com.massivecraft.factions.scoreboards.FInfoBoard;
|
||||
import com.massivecraft.factions.scoreboards.sidebar.FInfoSidebar;
|
||||
import com.massivecraft.factions.scoreboards.FScoreboard;
|
||||
import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
@@ -121,16 +121,6 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
|
||||
}
|
||||
}
|
||||
|
||||
public FScoreboard activeBoard;
|
||||
|
||||
public FScoreboard getActiveBoard() {
|
||||
return this.activeBoard;
|
||||
}
|
||||
|
||||
public void setActiveBoard(FScoreboard board) {
|
||||
this.activeBoard = board;
|
||||
}
|
||||
|
||||
// FIELD: autoSafeZoneEnabled
|
||||
private transient boolean autoSafeZoneEnabled;
|
||||
|
||||
@@ -551,7 +541,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
|
||||
Faction toShow = Board.getFactionAt(getLastStoodAt());
|
||||
if (shouldShowScoreboard(toShow)) {
|
||||
// Shows them the scoreboard instead of sending a message in chat. Will disappear after a few seconds.
|
||||
new FInfoBoard(getPlayer(), toShow, true);
|
||||
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
||||
} else {
|
||||
String msg = P.p.txt.parse("<i>") + " ~ " + toShow.getTag(this);
|
||||
if (toShow.getDescription().length() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user