3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-09 17:50:20 +01:00

Fix more scoreboard crashing and oddities (#1665)

* Various fixes

* Apply updateType fix as well

* Slight optimization
Dieser Commit ist enthalten in:
Camotoy 2020-12-14 18:22:31 -05:00 committet von GitHub
Ursprung feaaf9edec
Commit 55cf7d1c54
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 13 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -36,8 +36,14 @@ public final class Score {
private final String name; private final String name;
private ScoreInfo cachedInfo; private ScoreInfo cachedInfo;
private ScoreData currentData; /**
private ScoreData cachedData; * Changes that have been made since the last cached data.
*/
private Score.ScoreData currentData;
/**
* The data that is currently displayed to the Bedrock client.
*/
private Score.ScoreData cachedData;
public Score(long id, String name) { public Score(long id, String name) {
this.id = id; this.id = id;
@ -79,7 +85,7 @@ public final class Score {
} }
public UpdateType getUpdateType() { public UpdateType getUpdateType() {
return cachedData != null ? cachedData.updateType : currentData.updateType; return currentData.updateType;
} }
public Score setUpdateType(UpdateType updateType) { public Score setUpdateType(UpdateType updateType) {

Datei anzeigen

@ -189,7 +189,10 @@ public final class Scoreboard {
remove = false; remove = false;
} }
if (score.shouldUpdate()) { if (objectiveRemove && score.getCachedData() != null) {
// This score has been sent to the client and needs to be removed since the objective is being removed
remove = true;
} else if (score.shouldUpdate()) {
score.update(objective.getObjectiveName()); score.update(objective.getObjectiveName());
} }