diff --git a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch index 492dac7e7a..082c54e6dd 100644 --- a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch @@ -12,9 +12,18 @@ 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 d8874c398..6fbf841f0 100644 +index c72bdd29d1..c7b0cdaa20 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + private final List l = Lists.newArrayList(); + public final MethodProfiler methodProfiler = new MethodProfiler(); + private ServerConnection m; // Spigot +- private final ServerPing n = new ServerPing(); ++4 private final ServerPing n = new ServerPing(); + private final Random o = new Random(); + public final DataFixer dataConverterManager; + private String serverIp; @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; @@ -99,7 +108,7 @@ index d8874c398..6fbf841f0 100644 // Spigot start Arrays.fill( recentTps, 20 ); -- long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; +- long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick, tickCount = 1; + long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop while (this.isRunning) { curTime = System.nanoTime(); @@ -127,7 +136,7 @@ index d8874c398..6fbf841f0 100644 + wait = TICK_TIME - (curTime - lastTick); } -- if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) +- if ( tickCount++ % SAMPLE_INTERVAL == 0 ) + catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait); + if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) { @@ -149,7 +158,7 @@ index d8874c398..6fbf841f0 100644 } lastTick = curTime; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c2d479dd1..d28205cdf 100644 +index c2d479dd11..d28205cdfc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -171,7 +180,7 @@ index c2d479dd1..d28205cdf 100644 { diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java -index be2e31dea..6d21c3269 100644 +index be2e31deae..6d21c32692 100644 --- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java +++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java @@ -0,0 +0,0 @@