diff --git a/Spigot-Server-Patches/Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/Spigot-Server-Patches/Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 94f40b824d..0563a05afc 100644 --- a/Spigot-Server-Patches/Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/Spigot-Server-Patches/Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -61,9 +61,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - correctly register player BEFORE PlayerJoinEvent, so the entity is valid and doesn't require tick delay hacks + entityplayer.supressTrackerForLogin = true; -+ worldserver.addPlayerJoin(entityplayer); ++ worldserver1.addPlayerJoin(entityplayer); + this.server.getBossBattleCustomData().a(entityplayer); // see commented out section below worldserver.addPlayerJoin(entityplayer); -+ mountSavedVehicle(entityplayer, worldserver, nbttagcompound); ++ mountSavedVehicle(entityplayer, worldserver1, nbttagcompound); + // Paper end // CraftBukkit start PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage); @@ -82,9 +82,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper start - move vehicle into method so it can be called above - short circuit around that code -+ onPlayerJoinFinish(entityplayer, worldserver, s1); ++ onPlayerJoinFinish(entityplayer, worldserver1, s1); + } -+ private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver, NBTTagCompound nbttagcompound) { ++ private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver1, NBTTagCompound nbttagcompound) { + // Paper end if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); diff --git a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch index 87ed664b06..69449fc646 100644 --- a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b())); playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry())); -+ playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client ++ playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver1.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client this.d(entityplayer); entityplayer.getStatisticManager().c(); entityplayer.B().a(entityplayer); diff --git a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index ee4cbb798c..7d5081bb93 100644 --- a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -1149,23 +1149,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ); - PlayerChunkMap playerChunkMap = finalWorldserver.getChunkProvider().playerChunkMap; + PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap; playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); -- worldserver.getChunkProvider().tickDistanceManager(); -- worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { -+ worldserver.getChunkProvider().markAreaHighPriority(pos, 28, 3); -+ worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> { +- worldserver1.getChunkProvider().tickDistanceManager(); +- worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { ++ worldserver1.getChunkProvider().markAreaHighPriority(pos, 28, 3); ++ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> { PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair()); if (updatingChunk != null) { return updatingChunk.getEntityTickingFuture(); -@@ -0,0 +0,0 @@ public abstract class PlayerList { - entityplayer, finalWorldserver, finalWorldserver1, networkmanager, playerconnection, - nbttagcompound, networkmanager.getSocketAddress().toString(), lastKnownName - ); -- //playerChunkMap.chunkDistanceManager.removeTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); - }; - }); - } @@ -0,0 +0,0 @@ public abstract class PlayerList { SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress(); diff --git a/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch b/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch index fb887b8f77..78e44aeffa 100644 --- a/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch +++ b/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch @@ -113,14 +113,6 @@ diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ import java.util.Map; - import java.util.Optional; - import java.util.Set; - import java.util.UUID; -+import java.util.concurrent.CompletableFuture; - import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; @@ -0,0 +0,0 @@ public abstract class PlayerList { private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private final MinecraftServer server; @@ -161,28 +153,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.sendScoreboard(worldserver1.getScoreboard(), entityplayer); this.server.invalidatePingSample(); + // Paper start - async load spawn in chunk -+ WorldServer finalWorldserver = worldserver; -+ WorldServer finalWorldserver1 = worldserver1; ++ WorldServer finalWorldserver = worldserver1; + int chunkX = loc.getBlockX() >> 4; + int chunkZ = loc.getBlockZ() >> 4; + final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ); -+ PlayerChunkMap playerChunkMap = finalWorldserver.getChunkProvider().playerChunkMap; ++ PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap; + playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); -+ worldserver.getChunkProvider().tickDistanceManager(); -+ worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { ++ worldserver1.getChunkProvider().tickDistanceManager(); ++ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { + PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair()); + if (updatingChunk != null) { + return updatingChunk.getEntityTickingFuture(); + } else { -+ return CompletableFuture.completedFuture(chunk); ++ return java.util.concurrent.CompletableFuture.completedFuture(chunk); + } + }).thenAccept(chunk -> { + playerconnection.playerJoinReady = () -> { + postChunkLoadJoin( -+ entityplayer, finalWorldserver, finalWorldserver1, networkmanager, playerconnection, ++ entityplayer, finalWorldserver, networkmanager, playerconnection, + nbttagcompound, networkmanager.getSocketAddress().toString(), lastKnownName + ); -+ //playerChunkMap.chunkDistanceManager.removeTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); + }; + }); + } @@ -200,7 +190,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }); + } + -+ private void postChunkLoadJoin(EntityPlayer entityplayer, WorldServer worldserver, WorldServer worldserver1, NetworkManager networkmanager, PlayerConnection playerconnection, NBTTagCompound nbttagcompound, String s1, String s) { ++ private void postChunkLoadJoin(EntityPlayer entityplayer, WorldServer worldserver1, NetworkManager networkmanager, PlayerConnection playerconnection, NBTTagCompound nbttagcompound, String s1, String s) { + pendingPlayers.remove(entityplayer.getUniqueID(), entityplayer); + if (!networkmanager.isConnected()) { + return; @@ -211,35 +201,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entityplayer.getProfile().getName().equalsIgnoreCase(s)) { @@ -0,0 +0,0 @@ public abstract class PlayerList { - entityplayer.supressTrackerForLogin = true; - worldserver.addPlayerJoin(entityplayer); - this.server.getBossBattleCustomData().a(entityplayer); // see commented out section below worldserver.addPlayerJoin(entityplayer); -- mountSavedVehicle(entityplayer, worldserver, nbttagcompound); -+ mountSavedVehicle(entityplayer, worldserver, worldserver1, nbttagcompound); - // Paper end - // CraftBukkit start - PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage); -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - entityplayer.sentListPacket = true; - entityplayer.supressTrackerForLogin = false; // Paper -- ((WorldServer)entityplayer.world).getChunkProvider().playerChunkMap.addEntity(entityplayer); // Paper - track entity now - // CraftBukkit end - - entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - - // Paper start - move vehicle into method so it can be called above - short circuit around that code -+ ((WorldServer)entityplayer.world).getChunkProvider().playerChunkMap.addEntity(entityplayer); // track entity now - onPlayerJoinFinish(entityplayer, worldserver, s1); - } -- private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver, NBTTagCompound nbttagcompound) { -+ private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver, WorldServer worldserver1, NBTTagCompound nbttagcompound) { - // Paper end - if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) { - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); -@@ -0,0 +0,0 @@ public abstract class PlayerList { protected void savePlayerFile(EntityPlayer entityplayer) { if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit diff --git a/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 0160bc2f3e..02049c806a 100644 --- a/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -84,7 +84,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper start + private static boolean canSendImmediate(NetworkManager networkManager, Packet<?> packet) { -+ return networkManager.isPending || networkManager.protocol != EnumProtocol.PLAY || networkManager.queueImmunity || ++ return networkManager.isPending || networkManager.protocol != EnumProtocol.PLAY || + packet instanceof PacketPlayOutKeepAlive || + packet instanceof PacketPlayOutChat || + packet instanceof PacketPlayOutTabComplete; @@ -337,26 +337,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 default boolean packetTooLarge(NetworkManager manager) { return false; } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); - entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world) - entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); -+ networkmanager.queueImmunity = true; // Paper - // Spigot end - - // CraftBukkit - Moved message to after join -@@ -0,0 +0,0 @@ public abstract class PlayerList { - playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b())); - playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry())); - playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client -+ networkmanager.queueImmunity = false; // Paper - this.d(entityplayer); - entityplayer.getStatisticManager().c(); - entityplayer.B().a(entityplayer); diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java