diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 04ba46228..b8808d228 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -1,4 +1,4 @@ -From b633da3b27d8d9d4be6dad68c36f7c9cfed403cb Mon Sep 17 00:00:00 2001 +From 983b67ed126cac183574f9d8832b247327386df4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 04:00:11 -0600 Subject: [PATCH] Timings v2 @@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 0000000000..69e26a8267 +index 0000000000..223d3b1125 --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -0,0 +1,141 @@ @@ -144,7 +144,7 @@ index 0000000000..69e26a8267 + }*/ + + public static Timing getPacketTiming(Packet packet) { -+ return Timings.ofSafe("## Packet - " + packet.getClass().getSimpleName(), packetProcessTimer); ++ return Timings.ofSafe("## Packet - " + packet.getClass().getName(), packetProcessTimer); + } + + public static Timing getCommandFunctionTiming(CustomFunction function) { @@ -749,7 +749,7 @@ index 1f350e3352..35e3f1c78d 100644 } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b4a0bd7951..456d03be22 100644 +index b4a0bd7951..67bdd57747 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -63,7 +63,7 @@ import org.bukkit.craftbukkit.CraftServer; @@ -780,11 +780,16 @@ index b4a0bd7951..456d03be22 100644 // CraftBukkit start if (this.server != null) { this.server.disablePlugins(); -@@ -884,6 +885,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { + return !this.canOversleep(); + }); -+ MinecraftTimings.serverOversleep.stopTiming(); ++ isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); + // Paper end + ++this.ticks; this.b(booleansupplier); if (i - this.Z >= 5000000000L) { -@@ -997,14 +1016,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit @@ -844,7 +849,7 @@ index b4a0bd7951..456d03be22 100644 } this.methodProfiler.enter("snooper"); -@@ -1017,6 +1034,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Tue, 1 Mar 2016 14:32:43 -0600 Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang @@ -6,7 +6,7 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index 3f35a28ba..cf00f35a5 100644 +index 3f35a28ba1..cf00f35a5b 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java @@ -70,7 +70,7 @@ public class EULA { @@ -19,10 +19,10 @@ index 3f35a28ba..cf00f35a5 100644 throwable = throwable1; throw throwable1; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 456d03be2..35b226cd5 100644 +index 67bdd57747..e71ee0fb33 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1343,7 +1343,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Tue, 1 Mar 2016 23:09:29 -0600 Subject: [PATCH] Further improve server tick loop @@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2b3844ae5a..7b8c523e6d 100644 +index e71ee0fb33..53d0a98d00 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -160,7 +160,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() - + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); +- + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); ++ + ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise + } + } -- -2.25.1 +2.26.2 diff --git a/Spigot-Server-Patches/0032-Optimize-explosions.patch b/Spigot-Server-Patches/0032-Optimize-explosions.patch index db6fd460e..9b4271d9f 100644 --- a/Spigot-Server-Patches/0032-Optimize-explosions.patch +++ b/Spigot-Server-Patches/0032-Optimize-explosions.patch @@ -1,4 +1,4 @@ -From 7c796e60234f3887773d5a6d827c214b1303fdf6 Mon Sep 17 00:00:00 2001 +From 6b503392be4decc2138d29182e99bdd03145f7e3 Mon Sep 17 00:00:00 2001 From: Byteflux Date: Wed, 2 Mar 2016 11:59:48 -0600 Subject: [PATCH] Optimize explosions @@ -10,7 +10,7 @@ This patch adds a per-tick cache that is used for storing and retrieving an entity's exposure during an explosion. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 50dec5cb5..f038d3f7d 100644 +index 50dec5cb5e..f038d3f7dc 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -150,4 +150,10 @@ public class PaperWorldConfig { @@ -25,7 +25,7 @@ index 50dec5cb5..f038d3f7d 100644 + } } diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index a063d1bfa..5583860f1 100644 +index a063d1bfaa..5583860f15 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -177,7 +177,7 @@ public class Explosion { @@ -123,10 +123,10 @@ index a063d1bfa..5583860f1 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 91ea693bc..c9eb13119 100644 +index 53d0a98d00..11f81ab364 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1179,6 +1179,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Mon, 28 Mar 2016 19:55:45 -0400 Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener @@ -6,7 +6,7 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this diff --git a/src/main/java/net/minecraft/server/BlockPlant.java b/src/main/java/net/minecraft/server/BlockPlant.java -index ed1da4f4b..a6891b9fa 100644 +index ed1da4f4ba..a6891b9fa7 100644 --- a/src/main/java/net/minecraft/server/BlockPlant.java +++ b/src/main/java/net/minecraft/server/BlockPlant.java @@ -16,7 +16,7 @@ public class BlockPlant extends Block { @@ -19,7 +19,7 @@ index ed1da4f4b..a6891b9fa 100644 } } diff --git a/src/main/java/net/minecraft/server/BlockTallPlant.java b/src/main/java/net/minecraft/server/BlockTallPlant.java -index 42e86881b..6cdce1158 100644 +index 42e86881bd..6cdce11581 100644 --- a/src/main/java/net/minecraft/server/BlockTallPlant.java +++ b/src/main/java/net/minecraft/server/BlockTallPlant.java @@ -55,7 +55,7 @@ public class BlockTallPlant extends BlockPlant { @@ -32,10 +32,10 @@ index 42e86881b..6cdce1158 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c9eb13119..1d3f1be24 100644 +index 11f81ab364..773f93edb7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1145,6 +1145,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6b1ff8f64..1edd03086 100644 +index 6b1ff8f64f..1edd030865 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -369,7 +369,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -66,7 +66,7 @@ index 6b1ff8f64..1edd03086 100644 this.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 96ed2da1f..9d0edf538 100644 +index 96ed2da1f8..9d0edf5382 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -75,6 +75,7 @@ public class WorldServer extends World { @@ -78,5 +78,5 @@ index 96ed2da1f..9d0edf538 100644 // Add env and gen to constructor public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { -- -2.26.0 +2.26.2 diff --git a/Spigot-Server-Patches/0096-remove-null-possibility-for-getServer-singleton.patch b/Spigot-Server-Patches/0096-remove-null-possibility-for-getServer-singleton.patch index f79d49078..1c49bcfa4 100644 --- a/Spigot-Server-Patches/0096-remove-null-possibility-for-getServer-singleton.patch +++ b/Spigot-Server-Patches/0096-remove-null-possibility-for-getServer-singleton.patch @@ -1,4 +1,4 @@ -From 9feee69060416cf7b59158ec4323bc80e2b2f4eb Mon Sep 17 00:00:00 2001 +From 8d22e60952c1d60ef7d029996897a2134b2a5753 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 28 Apr 2016 00:57:27 -0400 Subject: [PATCH] remove null possibility for getServer singleton @@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f82be54cc..54b4172e6 100644 +index 36d20d5e3a..a5aa6553cc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -68,6 +68,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot @@ -25,7 +25,7 @@ index f82be54cc..54b4172e6 100644 this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new); this.craftingManager = new CraftingManager(); this.tagRegistry = new TagRegistry(); -@@ -2184,7 +2186,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Fri, 9 Jun 2017 19:03:43 +0200 Subject: [PATCH] Use TerminalConsoleAppender for console improvements @@ -19,7 +19,7 @@ Other changes: configuration diff --git a/pom.xml b/pom.xml -index 3dc6c2a3..b1f00873 100644 +index 3dc6c2a3f5..b1f008738b 100644 --- a/pom.xml +++ b/pom.xml @@ -41,10 +41,27 @@ @@ -75,7 +75,7 @@ index 3dc6c2a3..b1f00873 100644 org.apache.maven.plugins diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java new file mode 100644 -index 00000000..cd6e2592 +index 0000000000..cd6e259239 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java @@ -0,0 +1,40 @@ @@ -121,7 +121,7 @@ index 00000000..cd6e2592 +} diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java new file mode 100644 -index 00000000..685deaa0 +index 0000000000..685deaa0e5 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java @@ -0,0 +1,17 @@ @@ -143,7 +143,7 @@ index 00000000..685deaa0 + +} diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 4b1f8c53..d34f772f 100644 +index 4b1f8c5373..d34f772fae 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -86,6 +86,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -185,7 +185,7 @@ index 4b1f8c53..d34f772f 100644 System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index af2fa93d..94f9201f 100644 +index 8d6a089007..284793e4bf 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -57,7 +57,7 @@ import org.apache.commons.lang3.Validate; @@ -234,7 +234,7 @@ index af2fa93d..94f9201f 100644 } catch (Exception ignored) { } // CraftBukkit end -@@ -1473,7 +1477,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant -- -2.25.1.windows.1 +2.26.2 diff --git a/Spigot-Server-Patches/0155-Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/0155-Basic-PlayerProfile-API.patch index 942ea077b..7e71052d8 100644 --- a/Spigot-Server-Patches/0155-Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/0155-Basic-PlayerProfile-API.patch @@ -1,4 +1,4 @@ -From 210d72e066a073c2bcce64032a1a0037641c369d Mon Sep 17 00:00:00 2001 +From 8a6737ec1d8a570f928e92e023d0edb85c27cc0a Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 15 Jan 2018 22:11:48 -0500 Subject: [PATCH] Basic PlayerProfile API @@ -7,7 +7,7 @@ Establishes base extension of profile systems for future edits too diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java new file mode 100644 -index 00000000..b151a13c +index 0000000000..b151a13c1b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java @@ -0,0 +1,280 @@ @@ -293,7 +293,7 @@ index 00000000..b151a13c +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java new file mode 100644 -index 00000000..25836b97 +index 0000000000..25836b975b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java @@ -0,0 +1,30 @@ @@ -329,7 +329,7 @@ index 00000000..25836b97 +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java new file mode 100644 -index 00000000..3bcdb8f9 +index 0000000000..3bcdb8f93f --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java @@ -0,0 +1,17 @@ @@ -352,7 +352,7 @@ index 00000000..3bcdb8f9 +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java new file mode 100644 -index 00000000..4b2a6742 +index 0000000000..4b2a67423f --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java @@ -0,0 +1,29 @@ @@ -387,7 +387,7 @@ index 00000000..4b2a6742 +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java new file mode 100644 -index 00000000..3aceb0ea +index 0000000000..3aceb0ea8a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java @@ -0,0 +1,11 @@ @@ -403,7 +403,7 @@ index 00000000..3aceb0ea + } +} diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 48f88eab..9d0b0c9f 100644 +index 48f88eaba4..9d0b0c9fc3 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -1,7 +1,10 @@ @@ -429,10 +429,10 @@ index 48f88eab..9d0b0c9f 100644 * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 94f9201f..ae939c9b 100644 +index 284793e4bf..1f27939670 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1299,7 +1299,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Wed, 11 Oct 2017 15:56:26 +0200 Subject: [PATCH] Implement extended PaperServerListPingEvent @@ -6,7 +6,7 @@ Subject: [PATCH] Implement extended PaperServerListPingEvent diff --git a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java new file mode 100644 -index 00000000..c1a8e295 +index 0000000000..c1a8e295b6 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java @@ -0,0 +1,31 @@ @@ -43,7 +43,7 @@ index 00000000..c1a8e295 +} diff --git a/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java new file mode 100644 -index 00000000..a2a409e6 +index 0000000000..a2a409e635 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java @@ -0,0 +1,11 @@ @@ -60,7 +60,7 @@ index 00000000..a2a409e6 +} diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java new file mode 100644 -index 00000000..a85466bc +index 0000000000..a85466bc7e --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java @@ -0,0 +1,112 @@ @@ -177,7 +177,7 @@ index 00000000..a85466bc + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ae939c9b..b292e504 100644 +index 1f27939670..c502aedb8d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1,6 +1,9 @@ @@ -190,7 +190,7 @@ index ae939c9b..b292e504 100644 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gson.JsonElement; -@@ -1090,7 +1093,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { this.Z = i; this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount())); @@ -200,7 +200,7 @@ index ae939c9b..b292e504 100644 for (int k = 0; k < agameprofile.length; ++k) { diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 658ea609..4bb21c48 100644 +index 658ea609cb..4bb21c48bd 100644 --- a/src/main/java/net/minecraft/server/PacketStatusListener.java +++ b/src/main/java/net/minecraft/server/PacketStatusListener.java @@ -37,6 +37,8 @@ public class PacketStatusListener implements PacketStatusInListener { @@ -223,7 +223,7 @@ index 658ea609..4bb21c48 100644 // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java -index aa125a52..ea52e89b 100644 +index aa125a52dc..ea52e89bd9 100644 --- a/src/main/java/net/minecraft/server/ServerPing.java +++ b/src/main/java/net/minecraft/server/ServerPing.java @@ -29,6 +29,7 @@ public class ServerPing { @@ -248,7 +248,7 @@ index aa125a52..ea52e89b 100644 this.c = agameprofile; } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 6d77bbc5..1cf214ea 100644 +index 6d77bbc5aa..1cf214eaca 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -285,7 +285,7 @@ public class SpigotConfig @@ -261,5 +261,5 @@ index 6d77bbc5..1cf214ea 100644 } -- -2.25.1.windows.1 +2.26.2 diff --git a/Spigot-Server-Patches/0322-Optimize-World-Time-Updates.patch b/Spigot-Server-Patches/0322-Optimize-World-Time-Updates.patch index f4bbab815..b8844bc2e 100644 --- a/Spigot-Server-Patches/0322-Optimize-World-Time-Updates.patch +++ b/Spigot-Server-Patches/0322-Optimize-World-Time-Updates.patch @@ -1,4 +1,4 @@ -From 0ba45a336be648a77a19ac85a38592499dc56dfd Mon Sep 17 00:00:00 2001 +From a9c88692d81b76abc1d47c7e59d2d1d760367b65 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 2 Nov 2018 23:11:51 -0400 Subject: [PATCH] Optimize World Time Updates @@ -8,10 +8,10 @@ the updates per world, so that we can re-use the same packet object for every player unless they have per-player time enabled. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e7197f20..4d604bd0 100644 +index c97bbe933d..3d9cc2ce67 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1164,12 +1164,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Wed, 27 Mar 2019 22:48:45 -0400 Subject: [PATCH] Server Tick Events @@ -6,18 +6,18 @@ Subject: [PATCH] Server Tick Events Fires event at start and end of a server tick diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4d604bd0..2a8e097f 100644 +index 3d9cc2ce67..249eaf56bc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1087,6 +1087,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Mon, 13 May 2019 21:10:59 -0700 Subject: [PATCH] Fix CraftServer#isPrimaryThread and MinecraftServer @@ -16,10 +16,10 @@ handling that should have been handled synchronously will be handled synchronously when the server gets shut down. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2a8e097f..91af2563 100644 +index 249eaf56bc..45882ee30f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2215,7 +2215,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Sun, 9 Jun 2019 03:53:22 +0100 Subject: [PATCH] incremental chunk saving @@ -62,7 +62,7 @@ index b7a2cd7342..0dd873a5dd 100644 public void close() throws IOException { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e9841ef58d..7ca4a7cca8 100644 +index 0ee1d8e486..7ecf781263 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -168,6 +168,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Sat, 13 Jul 2019 09:23:10 -0700 Subject: [PATCH] Asynchronous chunk IO and loading @@ -3022,7 +3022,7 @@ index 2dcecc1bbd..d9941b38ca 100644 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7ca4a7cca8..61fc659ed2 100644 +index 7ecf781263..26be349870 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -777,6 +777,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> ret = new CompletableFuture<>(); + + Consumer chunkHolderConsumer = (ChunkRegionLoader.InProgressChunkHolder holder) -> { -+ PlayerChunkMap.this.executor.addTask(() -> { -+ ret.complete(syncLoadComplete.apply(holder, null)); ++ // Go into the chunk load queue and not server task queue so we can be popped out even faster. ++ com.destroystokyo.paper.io.chunk.ChunkTaskManager.queueChunkWaitTask(() -> { ++ try { ++ ret.complete(syncLoadComplete.apply(holder, null)); ++ } catch (Exception e) { ++ ret.completeExceptionally(e); ++ } + }); + }; + @@ -3347,7 +3352,7 @@ index b4c9d544fe..7e5fa016c7 100644 } private CompletableFuture> b(PlayerChunk playerchunk, ChunkStatus chunkstatus) { -@@ -822,18 +914,43 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -822,18 +919,43 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return this.u.get(); } @@ -3399,7 +3404,7 @@ index b4c9d544fe..7e5fa016c7 100644 ichunkaccess.setLastSaved(this.world.getTime()); ichunkaccess.setNeedsSaving(false); -@@ -844,28 +961,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -844,28 +966,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { NBTTagCompound nbttagcompound; if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { @@ -3437,7 +3442,7 @@ index b4c9d544fe..7e5fa016c7 100644 } protected void setViewDistance(int i) { -@@ -969,6 +1093,42 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -969,6 +1098,42 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } } @@ -3480,7 +3485,7 @@ index b4c9d544fe..7e5fa016c7 100644 @Nullable public NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { // Paper - private -> public NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); -@@ -991,33 +1151,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -991,33 +1156,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - chunk status cache "api" public ChunkStatus getChunkStatusOnDiskIfCached(ChunkCoordIntPair chunkPos) { @@ -3547,7 +3552,7 @@ index b4c9d544fe..7e5fa016c7 100644 } public IChunkAccess getUnloadingChunk(int chunkX, int chunkZ) { -@@ -1026,6 +1208,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1026,6 +1213,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end @@ -3587,7 +3592,7 @@ index b4c9d544fe..7e5fa016c7 100644 boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { // Spigot start return isOutsideOfRange(chunkcoordintpair, false); -@@ -1371,6 +1586,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1371,6 +1591,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -4170,5 +4175,5 @@ index 07936eeba2..5bdcdcf9e8 100644 log.log( Level.SEVERE, "------------------------------" ); // -- -2.25.1 +2.26.2 diff --git a/Spigot-Server-Patches/0414-Optimize-Hoppers.patch b/Spigot-Server-Patches/0414-Optimize-Hoppers.patch index 2a24622ab..ddd1ff36b 100644 --- a/Spigot-Server-Patches/0414-Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/0414-Optimize-Hoppers.patch @@ -1,4 +1,4 @@ -From 30b5dc4b6adee3603770473e1799d48e597b14c9 Mon Sep 17 00:00:00 2001 +From 590aedc1bb3a7452d665965d965a1f4e41f53c9a Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 27 Apr 2016 22:09:52 -0400 Subject: [PATCH] Optimize Hoppers @@ -73,10 +73,10 @@ index d953cdef14..d6e43313bf 100644 itemstack.d(this.C()); if (this.tag != null) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 61fc659ed2..177d1445ad 100644 +index 26be349870..63db74993c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1217,6 +1217,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper @@ -385,5 +385,5 @@ index 568e04faa3..9e161746f2 100644 int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); int j = MathHelper.f((axisalignedbb.maxX + 2.0D) / 16.0D); -- -2.25.1 +2.26.2 diff --git a/Spigot-Server-Patches/0447-Reduce-entity-tracker-updates-on-move.patch b/Spigot-Server-Patches/0447-Reduce-entity-tracker-updates-on-move.patch index 7e7fb5c4d..37ec006e1 100644 --- a/Spigot-Server-Patches/0447-Reduce-entity-tracker-updates-on-move.patch +++ b/Spigot-Server-Patches/0447-Reduce-entity-tracker-updates-on-move.patch @@ -1,4 +1,4 @@ -From 5372ac364bf598a98dc866d750ddba5123f3033a Mon Sep 17 00:00:00 2001 +From ee5f32adf9899ad77d47aa5e49d30b2175533a6b Mon Sep 17 00:00:00 2001 From: froobynooby Date: Thu, 20 Feb 2020 15:50:49 +0930 Subject: [PATCH] Reduce entity tracker updates on move @@ -40,7 +40,7 @@ packets often show up as a major contributor to TPS loss in servers with large player counts diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7ca67a4a..e93176d8 100644 +index 7ca67a4aa5..e93176d8f2 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -668,4 +668,9 @@ public class PaperWorldConfig { @@ -54,7 +54,7 @@ index 7ca67a4a..e93176d8 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 24545b33..828ba458 100644 +index 24545b3349..828ba4584b 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -86,6 +86,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -69,7 +69,7 @@ index 24545b33..828ba458 100644 // CraftBukkit start public String displayName; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index f564502f..0186ab9e 100644 +index 70c4bf7287..f570c40496 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -133,6 +133,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -120,7 +120,7 @@ index f564502f..0186ab9e 100644 } public void updatePlayerMobTypeMap(Entity entity) { -@@ -1334,8 +1368,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1339,8 +1373,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } public void movePlayer(EntityPlayer entityplayer) { @@ -141,7 +141,7 @@ index f564502f..0186ab9e 100644 while (objectiterator.hasNext()) { PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = (PlayerChunkMap.EntityTracker) objectiterator.next(); -@@ -1345,6 +1390,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1350,6 +1395,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { playerchunkmap_entitytracker.updatePlayer(entityplayer); } } @@ -149,7 +149,7 @@ index f564502f..0186ab9e 100644 int i = MathHelper.floor(entityplayer.locX()) >> 4; int j = MathHelper.floor(entityplayer.locZ()) >> 4; -@@ -1486,12 +1532,21 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1491,12 +1537,21 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { playerchunkmap_entitytracker.clear(entityplayer); } @@ -171,7 +171,7 @@ index f564502f..0186ab9e 100644 } entity.tracker = null; // Paper - We're no longer tracked } -@@ -1532,7 +1587,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1537,7 +1592,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } world.timings.tracker2.stopTiming(); // Paper } @@ -180,7 +180,7 @@ index f564502f..0186ab9e 100644 } -@@ -1581,6 +1636,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1586,6 +1641,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } } } @@ -188,7 +188,7 @@ index f564502f..0186ab9e 100644 Iterator iterator; Entity entity1; -@@ -1677,6 +1733,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1682,6 +1738,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { org.spigotmc.AsyncCatcher.catchOp("player tracker clear"); // Spigot if (this.trackedPlayers.remove(entityplayer)) { this.trackerEntry.a(entityplayer); @@ -196,7 +196,7 @@ index f564502f..0186ab9e 100644 } } -@@ -1713,9 +1770,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1718,9 +1775,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (flag1 && this.trackedPlayerMap.putIfAbsent(entityplayer, true) == null) { // Paper this.trackerEntry.b(entityplayer); @@ -209,5 +209,5 @@ index f564502f..0186ab9e 100644 } -- -2.25.1.windows.1 +2.26.2 diff --git a/Spigot-Server-Patches/0453-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/Spigot-Server-Patches/0453-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index b6bc0eb94..c5ed05865 100644 --- a/Spigot-Server-Patches/0453-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/Spigot-Server-Patches/0453-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -1,4 +1,4 @@ -From feee85c5270a67f4b6c53789ecf8509aeaf81ec3 Mon Sep 17 00:00:00 2001 +From 6a1574bd21ab6847006a7442f92ec0d6ec49e974 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 2 Apr 2020 01:42:39 -0400 Subject: [PATCH] Prevent Double PlayerChunkMap adds crashing server @@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0186ab9e40..e1e4ea793a 100644 +index f570c40496..be75b9dd14 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1484,6 +1484,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1489,6 +1489,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { protected void addEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot @@ -47,5 +47,5 @@ index b3e1e3686b..142770bcd6 100644 if (entity.origin == null) { entity.origin = entity.getBukkitEntity().getLocation(); -- -2.25.1 +2.26.2 diff --git a/Spigot-Server-Patches/0457-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/0457-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index d15d026b7..854d5c0e6 100644 --- a/Spigot-Server-Patches/0457-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/0457-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -1,4 +1,4 @@ -From ce1db781f0616e0667f80d3395381026b1107547 Mon Sep 17 00:00:00 2001 +From cbbb713b9977ebf9c0df1bbc3b8f23112867da14 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 8 Apr 2020 03:06:30 -0400 Subject: [PATCH] Optimize PlayerChunkMap memory use for visibleChunks @@ -76,7 +76,7 @@ index d9941b38ca..71ab65e00f 100644 List allChunks = new ArrayList<>(visibleChunks.values()); List players = world.players; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index e1e4ea793a..e61ddeb1ff 100644 +index be75b9dd14..90e4811157 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -55,8 +55,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -197,7 +197,7 @@ index e1e4ea793a..e61ddeb1ff 100644 this.updatingChunksModified = false; return true; } -@@ -1104,12 +1163,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1109,12 +1168,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } protected Iterable f() { @@ -271,5 +271,5 @@ index 051506fce8..630d6470a4 100644 return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.server.Chunk::getBukkitChunk).toArray(Chunk[]::new); } -- -2.25.1 +2.26.2 diff --git a/Spigot-Server-Patches/0460-Speed-up-processing-of-chunk-loads-and-generation.patch b/Spigot-Server-Patches/0460-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch similarity index 57% rename from Spigot-Server-Patches/0460-Speed-up-processing-of-chunk-loads-and-generation.patch rename to Spigot-Server-Patches/0460-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch index 558bd13bd..401483658 100644 --- a/Spigot-Server-Patches/0460-Speed-up-processing-of-chunk-loads-and-generation.patch +++ b/Spigot-Server-Patches/0460-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch @@ -1,7 +1,8 @@ -From df60dff93009e0cf28dc3e5b984d1a5afbf93bd2 Mon Sep 17 00:00:00 2001 +From fb41ea17cc836804549b69cb7112416be1b156c0 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 9 Apr 2020 00:09:26 -0400 -Subject: [PATCH] Speed up processing of chunk loads and generation +Subject: [PATCH] Mid Tick Chunk Tasks - Speed up processing of chunk loads and + generation Credit to Spotted for the idea @@ -24,16 +25,12 @@ looking for work to do. We do this in a fair method that considers all worlds, not just the one being ticked, so that each world can get 1 task procesed each before the next pass. -We also cap the throughput of these task processes to 1 per world per 0.1ms or -200 max per tick, to ensure that high volume of tasks do not overload the current -tick time. - In a view distance of 15, chunk loading performance was visually faster on the client. Flying at high speed in spectator mode was able to keep up with chunk loading (as long as they are already generated) diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java -index 69e26a8267..434833d50e 100644 +index 223d3b1125..37341d2d2e 100644 --- a/src/main/java/co/aikar/timings/MinecraftTimings.java +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -13,6 +13,7 @@ import java.util.Map; @@ -44,8 +41,22 @@ index 69e26a8267..434833d50e 100644 public static final Timing playerListTimer = Timings.ofSafe("Player List"); public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions"); public static final Timing connectionTimer = Timings.ofSafe("Connection Handler"); +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 6916ed30c4..1e186f149c 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -428,4 +428,9 @@ public class PaperConfig { + */ + } + } ++ ++ public static int midTickChunkTasks = 1000; ++ private static void midTickChunkTasks() { ++ midTickChunkTasks = getInt("settings.chunk-tasks-per-tick", midTickChunkTasks); ++ } + } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 3d79e756d9..5fea6e56d5 100644 +index 3d79e756d9..98ce805a64 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -683,6 +683,7 @@ public class ChunkProviderServer extends IChunkProvider { @@ -81,37 +92,40 @@ index 3d79e756d9..5fea6e56d5 100644 } } }); -@@ -974,6 +977,38 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -974,6 +977,41 @@ public class ChunkProviderServer extends IChunkProvider { super.executeTask(runnable); } + // Paper start -+ private long lastChunkTask = 0; ++ private long lastMidTickChunkTask = 0; ++ public boolean pollChunkLoadTasks() { ++ if (com.destroystokyo.paper.io.chunk.ChunkTaskManager.pollChunkWaitQueue() || ChunkProviderServer.this.world.asyncChunkTaskManager.pollNextChunkTask()) { ++ try { ++ ChunkProviderServer.this.tickDistanceManager(); ++ } finally { ++ // from below: process pending Chunk loadCallback() and unloadCallback() after each run task ++ playerChunkMap.callbackExecutor.run(); ++ } ++ return true; ++ } ++ return false; ++ } + public void midTickLoadChunks() { + MinecraftServer server = ChunkProviderServer.this.world.getMinecraftServer(); -+ try (co.aikar.timings.Timing ignored = co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming()) { -+ while (server.canSleepForTick()) { -+ try { -+ // always try to load chunks as long as we aren't falling behind, restrain generation/other updates only. -+ boolean execChunkTask = com.destroystokyo.paper.io.chunk.ChunkTaskManager.pollChunkWaitQueue() || ChunkProviderServer.this.world.asyncChunkTaskManager.pollNextChunkTask(); // Paper -+ if (ChunkProviderServer.this.tickDistanceManager() || execChunkTask) { -+ continue; -+ } -+ long now = System.nanoTime(); -+ // cap to 1 task every 0.1ms per world and max 200 tasks per tick. -+ // Anything that doesn't make it past this can load during sleep -+ // we do not want to use this.executeNext as that also processes chunk loads and might count against task counter. -+ // We also have already ticked the distance manager above too. -+ if (server.chunksTasksRan < 200 && now - lastChunkTask > 100000 && super.executeNext()) { -+ ChunkProviderServer.this.lightEngine.queueUpdate(); -+ server.chunksTasksRan++; -+ lastChunkTask = now; -+ } -+ break; -+ } finally { -+ // from below: process pending Chunk loadCallback() and unloadCallback() after each run task -+ playerChunkMap.callbackExecutor.run(); -+ } ++ // always try to load chunks, restrain generation/other updates only. don't count these towards tick count ++ //noinspection StatementWithEmptyBody ++ while (pollChunkLoadTasks()) {} ++ ++ if (System.nanoTime() - lastMidTickChunkTask < 1000000) { ++ return; ++ } ++ ++ for (;server.midTickChunksTasksRan < com.destroystokyo.paper.PaperConfig.midTickChunkTasks && server.canSleepForTick();) { ++ if (this.executeNext()) { ++ server.midTickChunksTasksRan++; ++ lastMidTickChunkTask = System.nanoTime(); ++ } else { ++ break; + } + } + } @@ -121,14 +135,14 @@ index 3d79e756d9..5fea6e56d5 100644 protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e35bacac71..2f424e6e8b 100644 +index 77adc64e30..3c25436f15 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -907,6 +907,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant iterator = this.getWorlds().iterator(); -+ while (this.canSleepForTick() && iterator.hasNext()) { -+ iterator.next().getChunkProvider().serverThreadQueue.midTickLoadChunks(); ++ try (co.aikar.timings.Timing ignored = co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming()) { ++ for (WorldServer value : this.getWorlds()) { ++ value.getChunkProvider().serverThreadQueue.midTickLoadChunks(); ++ } ++ midTickLastRan = System.nanoTime(); + } + } + // Paper end @@ -162,21 +179,54 @@ index e35bacac71..2f424e6e8b 100644 @Override protected TickTask postToMainThread(Runnable runnable) { return new TickTask(this.ticks, runnable); -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index e61ddeb1ff..92c9ab43d7 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -793,7 +793,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - CompletableFuture> ret = new CompletableFuture<>(); +@@ -1093,6 +1111,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { ++ midTickLoadChunks(); // will only do loads since we are still considered !canSleepForTick + return !this.canOversleep(); + }); + isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); +@@ -1175,13 +1194,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant chunkHolderConsumer = (ChunkRegionLoader.InProgressChunkHolder holder) -> { -- PlayerChunkMap.this.executor.addTask(() -> { -+ com.destroystokyo.paper.io.chunk.ChunkTaskManager.queueChunkWaitTask(() -> { - ret.complete(syncLoadComplete.apply(holder, null)); - }); - }; + protected void b(BooleanSupplier booleansupplier) { ++ midTickLoadChunks(); // Paper + MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper + this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit + MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper ++ midTickLoadChunks(); // Paper + this.methodProfiler.enter("commandFunctions"); + MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper + this.getFunctionData().tick(); + MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper ++ midTickLoadChunks(); // Paper + this.methodProfiler.exitEnter("levels"); + Iterator iterator = this.getWorlds().iterator(); + +@@ -1192,7 +1214,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Sun, 5 Apr 2020 22:23:14 -0500 Subject: [PATCH] Add tick times API and /mspt command @@ -6,7 +6,7 @@ Subject: [PATCH] Add tick times API and /mspt command diff --git a/src/main/java/com/destroystokyo/paper/MSPTCommand.java b/src/main/java/com/destroystokyo/paper/MSPTCommand.java new file mode 100644 -index 00000000..d0211d4f +index 0000000000..d0211d4f39 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/MSPTCommand.java @@ -0,0 +1,64 @@ @@ -75,7 +75,7 @@ index 00000000..d0211d4f + } +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 6916ed30..1c4cd363 100644 +index 1e186f149c..13d8934508 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -70,6 +70,7 @@ public class PaperConfig { @@ -87,7 +87,7 @@ index 6916ed30..1c4cd363 100644 version = getInt("config-version", 20); set("config-version", 20); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2f424e6e..7bfadb35 100644 +index a1d662f1e3..01534d19d4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -106,6 +106,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Sat, 11 Apr 2020 03:56:07 -0400 Subject: [PATCH] Implement Chunk Priority / Urgency System for World Gen @@ -16,7 +16,7 @@ lots of chunks already. This massively reduces the lag spikes from sync chunk gens. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 5fea6e56d5..bcf59beed6 100644 +index 98ce805a64..640265c3bd 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -308,6 +308,7 @@ public class ChunkProviderServer extends IChunkProvider { @@ -197,7 +197,7 @@ index 04b97cec29..568fbbd5f2 100644 private void d(int i) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 92c9ab43d7..c38d31fafe 100644 +index 90e4811157..0de3f6029c 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -324,6 +324,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -216,7 +216,7 @@ index 92c9ab43d7..c38d31fafe 100644 CompletableFuture> completablefuture = playerchunk.a(chunkstatus, this); list.add(completablefuture); -@@ -799,23 +801,28 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -804,23 +806,28 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; CompletableFuture chunkSaveFuture = this.world.asyncChunkTaskManager.getChunkSaveFuture(chunkcoordintpair.x, chunkcoordintpair.z); @@ -250,7 +250,7 @@ index 92c9ab43d7..c38d31fafe 100644 this.world.getMethodProfiler().c(() -> { return "chunkGenerate " + chunkstatus.d(); -@@ -843,6 +850,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -848,6 +855,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> { @@ -258,7 +258,7 @@ index 92c9ab43d7..c38d31fafe 100644 this.mailboxWorldGen.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error }); } -@@ -855,6 +863,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -860,6 +868,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { })); } @@ -266,7 +266,7 @@ index 92c9ab43d7..c38d31fafe 100644 private ChunkStatus a(ChunkStatus chunkstatus, int i) { ChunkStatus chunkstatus1; -@@ -979,9 +988,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -984,9 +993,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public CompletableFuture> a(PlayerChunk playerchunk) { ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); @@ -280,5 +280,5 @@ index 92c9ab43d7..c38d31fafe 100644 return either.flatMap((list) -> { Chunk chunk = (Chunk) list.get(list.size() / 2); -- -2.25.1 +2.26.2 diff --git a/Spigot-Server-Patches/0468-Forced-Watchdog-Crash-support-and-Improve-Async-Shut.patch b/Spigot-Server-Patches/0468-Forced-Watchdog-Crash-support-and-Improve-Async-Shut.patch index 5343778fd..791799fcd 100644 --- a/Spigot-Server-Patches/0468-Forced-Watchdog-Crash-support-and-Improve-Async-Shut.patch +++ b/Spigot-Server-Patches/0468-Forced-Watchdog-Crash-support-and-Improve-Async-Shut.patch @@ -1,4 +1,4 @@ -From 6a79fcb39fedf8d5f398026e6da8c616d34470f4 Mon Sep 17 00:00:00 2001 +From 2f634c7ef7576d0011a745b806127c13c4856c14 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 12 Apr 2020 15:50:48 -0400 Subject: [PATCH] Forced Watchdog Crash support and Improve Async Shutdown @@ -73,7 +73,7 @@ index cfe43e882e..2632c7c3ec 100644 } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7bfadb35d2..1086d1caac 100644 +index 01534d19d4..94daf684b1 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -144,6 +144,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Sat, 18 Apr 2020 04:36:11 -0400 Subject: [PATCH] Fix Chunk Post Processing deadlock risk @@ -25,43 +25,22 @@ This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 15bd3cacb3..2d4d7250f2 100644 +index 8f4d4f2283..e63333fcab 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -1019,6 +1019,7 @@ public class ChunkProviderServer extends IChunkProvider { - // we do not want to use this.executeNext as that also processes chunk loads and might count against task counter. - // We also have already ticked the distance manager above too. - if (server.chunksTasksRan < 200 && now - lastChunkTask > 100000 && super.executeNext()) { -+ ChunkProviderServer.this.playerChunkMap.chunkLoadConversionCallbackExecutor.run(); // run immediately after a task is potentially queued - ChunkProviderServer.this.lightEngine.queueUpdate(); - server.chunksTasksRan++; - lastChunkTask = now; -@@ -1042,7 +1043,11 @@ public class ChunkProviderServer extends IChunkProvider { - return true; - } else { - ChunkProviderServer.this.lightEngine.queueUpdate(); -- return super.executeNext() || execChunkTask; // Paper -+ // Paper start - Add chunk load conversion callback executor to prevent deadlock due to recursion in the chunk task queue sorter -+ boolean executed = super.executeNext(); -+ ChunkProviderServer.this.playerChunkMap.chunkLoadConversionCallbackExecutor.run(); // run immediately after a task is potentially queued -+ return executed || execChunkTask; -+ // Paper end - Add chunk load conversion callback executor to prevent deadlock due to recursion in the chunk task queue sorter +@@ -1048,6 +1048,7 @@ public class ChunkProviderServer extends IChunkProvider { + return super.executeNext() || execChunkTask; // Paper } } finally { ++ playerChunkMap.chunkLoadConversionCallbackExecutor.run(); // Paper - Add chunk load conversion callback executor to prevent deadlock due to recursion in the chunk task queue sorter playerChunkMap.callbackExecutor.run(); + } + // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index c38d31fafe..e19342eb89 100644 +index 0de3f6029c..f5a28e9322 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -92,6 +92,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - @Override - public void execute(Runnable runnable) { - if (queued != null) { -+ MinecraftServer.LOGGER.fatal("Failed to schedule runnable", new IllegalStateException("Already queued")); // Paper - make sure this is printed - throw new IllegalStateException("Already queued"); - } - queued = runnable; -@@ -108,6 +109,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -108,6 +108,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; // CraftBukkit end @@ -70,7 +49,7 @@ index c38d31fafe..e19342eb89 100644 // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -1002,7 +1005,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1007,7 +1009,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return Either.left(chunk); }); }, (runnable) -> { @@ -80,5 +59,5 @@ index c38d31fafe..e19342eb89 100644 completablefuture1.thenAcceptAsync((either) -> { -- -2.25.1 +2.26.2 diff --git a/Spigot-Server-Patches/0485-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/Spigot-Server-Patches/0485-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index c6f1a5106..7c2487dd4 100644 --- a/Spigot-Server-Patches/0485-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/Spigot-Server-Patches/0485-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -1,4 +1,4 @@ -From ecc9b88983b43be7ef71207cfc8dbfbe37af3933 Mon Sep 17 00:00:00 2001 +From 86c75a3c0ae4e295e196d3faf1e43f12e9f10782 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 19 Apr 2020 00:05:46 -0400 Subject: [PATCH] Fix Longstanding Broken behavior of PlayerJoinEvent @@ -28,7 +28,7 @@ receives a deterministic result, and should no longer require 1 tick delays anymore. diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index f3928b8f..686fd4cb 100644 +index f3928b8f6f..686fd4cbad 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -104,6 +104,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -40,10 +40,10 @@ index f3928b8f..686fd4cb 100644 // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index e19342eb..8b2eed10 100644 +index f5a28e9322..9425b36403 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1565,6 +1565,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1569,6 +1569,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { .printStackTrace(); return; } @@ -52,7 +52,7 @@ index e19342eb..8b2eed10 100644 if (!(entity instanceof EntityComplexPart)) { if (!(entity instanceof EntityLightning)) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 7403be0b..ec45c30d 100644 +index 7403be0b25..ec45c30dd3 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -175,6 +175,12 @@ public abstract class PlayerList { @@ -101,5 +101,5 @@ index 7403be0b..ec45c30d 100644 // Paper start - Add to collideRule team if needed final Scoreboard scoreboard = this.getServer().getWorldServer(DimensionManager.OVERWORLD).getScoreboard(); -- -2.25.1.windows.1 +2.26.2 diff --git a/Spigot-Server-Patches/0490-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch b/Spigot-Server-Patches/0490-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch index 53c140d28..06a4dd14e 100644 --- a/Spigot-Server-Patches/0490-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch +++ b/Spigot-Server-Patches/0490-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch @@ -1,4 +1,4 @@ -From 0f4ba3f787e0860be4e312a4eaaa2a9556624bf8 Mon Sep 17 00:00:00 2001 +From 74c25fa52e0597b02faef91663c35c1279a33369 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 21 Apr 2020 03:51:53 -0400 Subject: [PATCH] Allow multiple callbacks to schedule for Callback Executor @@ -11,35 +11,44 @@ needed within a single tick of ChunkMapDistance Use an ArrayDeque to store this Queue +We make sure to also implement a pattern that is recursion safe too. + diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 8b2eed10..ee0cabad 100644 +index 2ea06224f3..99b490374d 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -87,25 +87,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -87,24 +87,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { - private Runnable queued; -+ // Paper start - replace impl with Deque - possible multiple is needed in single pass -+ private java.util.Deque queued = new java.util.ArrayDeque<>(); ++ // Paper start - replace impl with recursive safe multi entry queue ++ // it's possible to schedule multiple tasks currently, so it's vital we change this impl ++ // If we recurse into the executor again, we will append to another queue, ensuring task order consistency ++ private java.util.ArrayDeque queued = new java.util.ArrayDeque<>(); @Override public void execute(Runnable runnable) { - if (queued != null) { -- MinecraftServer.LOGGER.fatal("Failed to schedule runnable", new IllegalStateException("Already queued")); // Paper - make sure this is printed - throw new IllegalStateException("Already queued"); -- } ++ if (queued == null) { ++ queued = new java.util.ArrayDeque<>(); + } - queued = runnable; -+ queued.add(runnable); // Paper ++ queued.add(runnable); } @Override public void run() { - Runnable task = queued; -- queued = null; ++ if (queued == null) { ++ return; ++ } ++ java.util.ArrayDeque queue = queued; + queued = null; - if (task != null) { + Runnable task; -+ while ((task = queued.pollFirst()) != null) { ++ while ((task = queue.pollFirst()) != null) { task.run(); } } @@ -48,5 +57,5 @@ index 8b2eed10..ee0cabad 100644 // CraftBukkit end -- -2.25.1.windows.1 +2.26.2