13
0
geforkt von Mirrors/Paper

Allow setting player list name early

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-20 15:24:42 +02:00
Ursprung b1a467786e
Commit ab63e7e64f

Datei anzeigen

@ -3997,6 +3997,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public void playerListName(net.kyori.adventure.text.Component name) {
+ getHandle().listName = name == null ? null : io.papermc.paper.adventure.PaperAdventure.asVanilla(name);
+ if (getHandle().connection == null) return; // Updates are possible before the player has fully joined
+ for (ServerPlayer player : server.getHandle().players) {
+ if (player.getBukkitEntity().canSee(this)) {
+ player.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME, getHandle()));
@ -4019,6 +4020,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public String getPlayerListName() {
return this.getHandle().listName == null ? this.getName() : CraftChatMessage.fromComponent(this.getHandle().listName);
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
name = this.getName();
}
this.getHandle().listName = name.equals(this.getName()) ? null : CraftChatMessage.fromStringOrNull(name);
+ if (this.getHandle().connection == null) return; // Paper - Updates are possible before the player has fully joined
for (ServerPlayer player : (List<ServerPlayer>) this.server.getHandle().players) {
if (player.getBukkitEntity().canSee(this)) {
player.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME, this.getHandle()));
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}