Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +01:00
Fix instances of invisible/flickering scoreboards
Dieser Commit ist enthalten in:
Ursprung
a7aa255784
Commit
9a159bf8be
@ -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();
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren