3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 15:50:14 +01:00

Fix edge case in removing below name objectives

Dieser Commit ist enthalten in:
Camotoy 2021-10-01 16:38:04 -04:00
Ursprung 86c0c009e7
Commit b58cbd00bc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -355,7 +355,9 @@ public class PlayerEntity extends LivingEntity {
session.sendUpstreamPacket(packet);
}
} else {
if (valid && metadata.remove(EntityData.SCORE_TAG) != null) {
// Always remove the score tag first, then check for valid.
// That way the score tag is removed if the player was spawned, then despawned, and is being respawned
if (metadata.remove(EntityData.SCORE_TAG) != null && valid) {
SetEntityDataPacket packet = new SetEntityDataPacket();
packet.setRuntimeEntityId(geyserId);
packet.getMetadata().put(EntityData.SCORE_TAG, "");

Datei anzeigen

@ -70,11 +70,9 @@ public class JavaScoreboardObjectiveTranslator extends PacketTranslator<ServerSc
if (objective != null && objective == scoreboard.getObjectiveSlots().get(ScoreboardPosition.BELOW_NAME)) {
// Clear the score tag from all players
for (PlayerEntity entity : session.getEntityCache().getAllPlayerEntities()) {
if (!entity.isValid()) {
// Player hasn't spawned yet - don't bother
continue;
}
// Other places we check for the entity being valid,
// but we must set the below name text as null for all players
// or else PlayerEntity#spawnEntity will find a null objective and not touch EntityData#SCORE_TAG
entity.setBelowNameText(session, null);
}
}