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:
Ursprung
feaaf9edec
Commit
55cf7d1c54
@ -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) {
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren