geforkt von Mirrors/Paper
058d7c1aa3
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 13eb4146 SPIGOT-5217, SPIGOT-6183: Add RespawnReason to PlayerRespawnEvent CraftBukkit Changes: 5ee3419b7 SPIGOT-5217, SPIGOT-6183: Add RespawnReason to PlayerRespawnEvent Spigot Changes: 514cf03a Rebuild patches and add RespawnReason.PLUGIN to Player#respawn
61 Zeilen
3.9 KiB
Diff
61 Zeilen
3.9 KiB
Diff
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 9029be5f8a1f2c0719bf5e4012f72b52cf82b060..f5888a2216a017b0db24ff7bfe2fc8f41b149605 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -3626,7 +3626,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 68e47dfff2519ed1fbe92f265f942fcc6cd6a00d..4d837c1530a3031a4c2a5a39d87bd013d60e14a6 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -308,7 +308,7 @@ public abstract class PlayerList {
|
|
player.sendServerStatus(serverping);
|
|
}
|
|
|
|
- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players));
|
|
+ // player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // Paper
|
|
this.players.add(player);
|
|
this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot
|
|
this.playersByUUID.put(player.getUUID(), player);
|
|
@@ -344,6 +344,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);
|
|
|
|
@@ -351,12 +352,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
|