diff options
author | Nassim Jahnke <[email protected]> | 2024-12-03 17:58:41 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-12-03 17:58:41 +0100 |
commit | c0a3d51ab35930e410fcd9752ceaff6c3f581c24 (patch) | |
tree | f53076a8b0787d2f544f73f468df94619e5eb1a5 /patches/unapplied/server/0778-Use-single-player-info-update-packet-on-join.patch | |
parent | da7138233f6392e791d790d1c3407414c855f9c2 (diff) | |
download | Paper-c0a3d51ab35930e410fcd9752ceaff6c3f581c24.tar.gz Paper-c0a3d51ab35930e410fcd9752ceaff6c3f581c24.zip |
Start update, apply API patches
Diffstat (limited to 'patches/unapplied/server/0778-Use-single-player-info-update-packet-on-join.patch')
-rw-r--r-- | patches/unapplied/server/0778-Use-single-player-info-update-packet-on-join.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/patches/unapplied/server/0778-Use-single-player-info-update-packet-on-join.patch b/patches/unapplied/server/0778-Use-single-player-info-update-packet-on-join.patch new file mode 100644 index 0000000000..a4901625a7 --- /dev/null +++ b/patches/unapplied/server/0778-Use-single-player-info-update-packet-on-join.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +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 762382b45afbc18810787858539fba62afc3e84c..66655aecd83138760e5d7601d22b95bb1bf0ec98 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -3487,7 +3487,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID()); + this.chatMessageChain.append(() -> { + 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 - Use single player info update packet on join + }); + } + +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 4b8636c2107e6a16c26f259e0dbdbc40a1268e06..7da3e315de67f3273997ce9160995183a3a1ce71 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -364,6 +364,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 on join + for (int i = 0; i < this.players.size(); ++i) { + ServerPlayer entityplayer1 = (ServerPlayer) this.players.get(i); + +@@ -371,12 +372,17 @@ public abstract class PlayerList { + entityplayer1.connection.send(packet); + } + +- if (!bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { ++ if (entityplayer1 == player || !bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { // Paper - Use single player info update packet on join; Don't include joining player + continue; + } + +- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1))); ++ onlinePlayers.add(entityplayer1); // Paper - Use single player info update packet on join + } ++ // Paper start - Use single player info update packet on join ++ if (!onlinePlayers.isEmpty()) { ++ player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers)); ++ } ++ // Paper end - Use single player info update packet on join + player.sentListPacket = true; + player.supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready + ((ServerLevel)player.level()).getChunkSource().chunkMap.addEntity(player); // Paper - Fire PlayerJoinEvent when Player is actually ready; track entity now |