geforkt von Mirrors/Paper
Use single player info update packet on join (#8773)
Dieser Commit ist enthalten in:
Ursprung
035f9d7157
Commit
214a8c54a4
@ -0,0 +1,60 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 8 Jan 2023 17:38:28 -0800
|
||||
Subject: [PATCH] Use single player info update packet on join
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 50d8d16b1856c0c875ccabbcfc240379a7669559..3472f7f9b98d6d9c9f6465872803ef17fa67486d 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3605,7 +3605,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID());
|
||||
this.chatMessageChain.append((executor) -> {
|
||||
this.player.setChatSession(session);
|
||||
- this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player)));
|
||||
+ this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player)), this.player); // Paper
|
||||
return CompletableFuture.completedFuture((Object) null);
|
||||
});
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 8961310c0789c4dd95a729ecc0b8dbf8d701ffc4..a01654bb553c00459e64f16e5ccc91b70cc84444 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -297,7 +297,7 @@ public abstract class PlayerList {
|
||||
|
||||
playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot());
|
||||
player.sendServerStatus(this.server.getStatus());
|
||||
- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players));
|
||||
+ // player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // Paper - use single player info update packet
|
||||
this.players.add(player);
|
||||
this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot
|
||||
this.playersByUUID.put(player.getUUID(), player);
|
||||
@@ -333,6 +333,7 @@ public abstract class PlayerList {
|
||||
// CraftBukkit start - sendAll above replaced with this loop
|
||||
ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player));
|
||||
|
||||
+ final List<ServerPlayer> onlinePlayers = Lists.newArrayListWithExpectedSize(this.players.size() - 1); // Paper - use single player info update packet
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
ServerPlayer entityplayer1 = (ServerPlayer) this.players.get(i);
|
||||
|
||||
@@ -340,12 +341,17 @@ public abstract class PlayerList {
|
||||
entityplayer1.connection.send(packet);
|
||||
}
|
||||
|
||||
- if (!bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) {
|
||||
+ if (entityplayer1 == player || !bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { // Paper - don't include joining player
|
||||
continue;
|
||||
}
|
||||
|
||||
- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1)));
|
||||
+ onlinePlayers.add(entityplayer1); // Paper - use single player info update packet
|
||||
}
|
||||
+ // Paper start - use single player info update packet
|
||||
+ if (!onlinePlayers.isEmpty()) {
|
||||
+ player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers));
|
||||
+ }
|
||||
+ // Paper end
|
||||
player.sentListPacket = true;
|
||||
player.supressTrackerForLogin = false; // Paper
|
||||
((ServerLevel)player.level).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren