Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Fix edge case in removing below name objectives
Dieser Commit ist enthalten in:
Ursprung
86c0c009e7
Commit
b58cbd00bc
@ -355,7 +355,9 @@ public class PlayerEntity extends LivingEntity {
|
|||||||
session.sendUpstreamPacket(packet);
|
session.sendUpstreamPacket(packet);
|
||||||
}
|
}
|
||||||
} else {
|
} 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();
|
SetEntityDataPacket packet = new SetEntityDataPacket();
|
||||||
packet.setRuntimeEntityId(geyserId);
|
packet.setRuntimeEntityId(geyserId);
|
||||||
packet.getMetadata().put(EntityData.SCORE_TAG, "");
|
packet.getMetadata().put(EntityData.SCORE_TAG, "");
|
||||||
|
@ -70,11 +70,9 @@ public class JavaScoreboardObjectiveTranslator extends PacketTranslator<ServerSc
|
|||||||
if (objective != null && objective == scoreboard.getObjectiveSlots().get(ScoreboardPosition.BELOW_NAME)) {
|
if (objective != null && objective == scoreboard.getObjectiveSlots().get(ScoreboardPosition.BELOW_NAME)) {
|
||||||
// Clear the score tag from all players
|
// Clear the score tag from all players
|
||||||
for (PlayerEntity entity : session.getEntityCache().getAllPlayerEntities()) {
|
for (PlayerEntity entity : session.getEntityCache().getAllPlayerEntities()) {
|
||||||
if (!entity.isValid()) {
|
// Other places we check for the entity being valid,
|
||||||
// Player hasn't spawned yet - don't bother
|
// but we must set the below name text as null for all players
|
||||||
continue;
|
// or else PlayerEntity#spawnEntity will find a null objective and not touch EntityData#SCORE_TAG
|
||||||
}
|
|
||||||
|
|
||||||
entity.setBelowNameText(session, null);
|
entity.setBelowNameText(session, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren