mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-01-11 04:21:16 +01:00
Fix instances of invisible/flickering scoreboards
This commit is contained in:
parent
a7aa255784
commit
9a159bf8be
2 changed files with 7 additions and 19 deletions
|
@ -150,20 +150,6 @@ public final class Objective {
|
|||
updateType = UpdateType.REMOVE;
|
||||
}
|
||||
|
||||
public ScoreboardPosition getPositionCategory() {
|
||||
return switch (displaySlot) {
|
||||
case PLAYER_LIST -> ScoreboardPosition.PLAYER_LIST;
|
||||
case BELOW_NAME -> ScoreboardPosition.BELOW_NAME;
|
||||
default -> ScoreboardPosition.SIDEBAR;
|
||||
};
|
||||
}
|
||||
|
||||
public boolean hasTeamColor() {
|
||||
return displaySlot != ScoreboardPosition.PLAYER_LIST &&
|
||||
displaySlot != ScoreboardPosition.BELOW_NAME &&
|
||||
displaySlot != ScoreboardPosition.SIDEBAR;
|
||||
}
|
||||
|
||||
public TeamColor getTeamColor() {
|
||||
return switch (displaySlot) {
|
||||
case SIDEBAR_TEAM_RED -> TeamColor.RED;
|
||||
|
|
|
@ -104,7 +104,7 @@ public final class Scoreboard {
|
|||
|
||||
Objective storedObjective = objectiveSlots.get(displaySlot);
|
||||
if (storedObjective != null && storedObjective != objective) {
|
||||
objective.pendingRemove();
|
||||
storedObjective.pendingRemove();
|
||||
}
|
||||
objectiveSlots.put(displaySlot, objective);
|
||||
|
||||
|
@ -166,6 +166,12 @@ public final class Scoreboard {
|
|||
correctSidebar = objectiveSlots.get(ScoreboardPosition.SIDEBAR);
|
||||
}
|
||||
|
||||
for (Objective objective : removedObjectives) {
|
||||
// Deletion must be handled before the active objectives are handled - otherwise if a scoreboard display is changed before the current
|
||||
// scoreboard is removed, the client can crash
|
||||
deleteObjective(objective, true);
|
||||
}
|
||||
|
||||
handleObjective(objectiveSlots.get(ScoreboardPosition.PLAYER_LIST), addScores, removeScores);
|
||||
handleObjective(correctSidebar, addScores, removeScores);
|
||||
handleObjective(objectiveSlots.get(ScoreboardPosition.BELOW_NAME), addScores, removeScores);
|
||||
|
@ -194,10 +200,6 @@ public final class Scoreboard {
|
|||
session.sendUpstreamPacket(setScorePacket);
|
||||
}
|
||||
|
||||
for (Objective objective : removedObjectives) {
|
||||
deleteObjective(objective, true);
|
||||
}
|
||||
|
||||
lastAddScoreCount = addScores.size();
|
||||
lastRemoveScoreCount = removeScores.size();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue