mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix #3537
This commit is contained in:
parent
f07f532d8e
commit
6ee3d4ed96
3 changed files with 14 additions and 2 deletions
|
@ -119,6 +119,8 @@ public class PlayerEntity extends LivingEntity {
|
|||
setBelowNameText(objective);
|
||||
}
|
||||
|
||||
// Update in case this entity has been despawned, then respawned
|
||||
this.nametag = this.username;
|
||||
// The name can't be updated later (the entity metadata for it is ignored), so we need to check for this now
|
||||
updateDisplayName(session.getWorldCache().getScoreboard().getTeamFor(username));
|
||||
|
||||
|
@ -339,6 +341,8 @@ public class PlayerEntity extends LivingEntity {
|
|||
this.nametag = this.username;
|
||||
}
|
||||
|
||||
System.out.println(this.username + " " + this.nametag + " " + needsUpdate);
|
||||
|
||||
if (needsUpdate) {
|
||||
dirtyMetadata.put(EntityData.NAMETAG, this.nametag);
|
||||
}
|
||||
|
|
|
@ -352,7 +352,8 @@ public final class Scoreboard {
|
|||
// With the player's lack of a team in visibility checks
|
||||
updateEntityNames(remove, remove.getEntities(), true);
|
||||
for (String name : remove.getEntities()) {
|
||||
playerToTeam.remove(name, remove);
|
||||
// 1.19.3 Mojmap Scoreboard#removePlayerTeam(PlayerTeam)
|
||||
playerToTeam.remove(name);
|
||||
}
|
||||
|
||||
session.removeCommandEnum("Geyser_Teams", remove.getId());
|
||||
|
|
|
@ -65,7 +65,14 @@ public final class Team {
|
|||
if (entities.add(name)) {
|
||||
added.add(name);
|
||||
}
|
||||
scoreboard.getPlayerToTeam().put(name, this);
|
||||
scoreboard.getPlayerToTeam().compute(name, (player, oldTeam) -> {
|
||||
if (oldTeam != null) {
|
||||
// Remove old team from this map, and from the set of players of the old team.
|
||||
// Java 1.19.3 Mojmap: Scoreboard#addPlayerToTeam calls #removePlayerFromTeam
|
||||
oldTeam.entities.remove(player);
|
||||
}
|
||||
return this;
|
||||
});
|
||||
}
|
||||
|
||||
if (added.isEmpty()) {
|
||||
|
|
Loading…
Reference in a new issue