Remove TPS catchup improvements

These changes are incompatbile as-is with 1.14 due to the Thread.sleep
call, this should ideally be brought back in the future
This commit is contained in:
Shane Freeder 2019-05-22 04:58:00 +01:00
parent c500f6a7fb
commit 08aaab0105
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C
12 changed files with 80 additions and 108 deletions

View file

@ -1,4 +1,4 @@
From 14d985bda1f2c27a8183951306c6e8d345e4126e Mon Sep 17 00:00:00 2001
From f3da067cdacebf6d94879911c518955217ef072c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 2fc8c192b..3a95b0bf8 100644
index 2fc8c192b..db60cbc7b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -150,7 +150,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -91,45 +91,27 @@ index 2fc8c192b..3a95b0bf8 100644
// Spigot End
public void run() {
@@ -769,30 +820,48 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -769,7 +820,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Spigot start
Arrays.fill( recentTps, 20 );
- long curTime, tickSection = SystemUtils.getMonotonicMillis(), tickCount = 1;
+ long start = System.nanoTime(), curTime, wait, tickSection = start; // Paper - Further improve server tick loop
+ long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
+ lastTick = start - TICK_TIME; // Paper
while (this.isRunning) {
- long i = (curTime = SystemUtils.getMonotonicMillis()) - this.nextTick;
-
- if (i > 5000L && this.nextTick - this.lastOverloadTime >= 30000L) { // CraftBukkit
- long j = i / 50L;
-
- if (server.getWarnOnOverload()) // CraftBukkit
long i = (curTime = SystemUtils.getMonotonicMillis()) - this.nextTick;
@@ -777,22 +829,29 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
long j = i / 50L;
if (server.getWarnOnOverload()) // CraftBukkit
- MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
- this.nextTick += j * 50L;
- this.lastOverloadTime = this.nextTick;
+ curTime = System.nanoTime();
+ // Paper start - Further improve server tick loop
+ wait = TICK_TIME - (curTime - lastTick);
+ if (wait > 0) {
+ if (catchupTime < 2E6) {
+ wait += Math.abs(catchupTime);
+ } else if (wait < catchupTime) {
+ catchupTime -= wait;
+ wait = 0;
+ } else {
+ wait -= catchupTime;
+ catchupTime = 0;
+ }
+ }
+ if (wait > 0) {
+ Thread.sleep(wait / 1000000);
+ curTime = System.nanoTime();
+ wait = TICK_TIME - (curTime - lastTick);
+ MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
this.nextTick += j * 50L;
this.lastOverloadTime = this.nextTick;
}
- if ( tickCount++ % SAMPLE_INTERVAL == 0 )
+ catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait);
+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 )
{
- double currentTps = 1E3 / ( curTime - tickSection ) * SAMPLE_INTERVAL;
@ -156,16 +138,6 @@ index 2fc8c192b..3a95b0bf8 100644
this.nextTick += 50L;
if (this.T) {
this.T = false;
@@ -860,8 +929,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
private boolean canSleepForTick() {
- // CraftBukkit start
- return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ac ? this.ab : this.nextTick);
+ return this.forceTicks || System.nanoTime() - lastTick + catchupTime < TICK_TIME; // Paper - improved "are we lagging" check to match our own
}
private void executeModerately() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 801ea70ac..f9563d038 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

View file

@ -1,4 +1,4 @@
From b3ae1eebf3dc0f1212ca650b9209d41d33107e91 Mon Sep 17 00:00:00 2001
From 75cb51560e9968f48a6d132d9659b2fa39383267 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
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 c2b9690a0c..a5ec0bc0e0 100644
index c2b9690a0..a5ec0bc0e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -145,4 +145,10 @@ public class PaperWorldConfig {
@ -25,7 +25,7 @@ index c2b9690a0c..a5ec0bc0e0 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index e1c628f177..bcff117619 100644
index e1c628f17..bcff11761 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -172,7 +172,7 @@ public class Explosion {
@ -123,10 +123,10 @@ index e1c628f177..bcff117619 100644
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1a75db6f49..fd1b268798 100644
index db60cbc7b..31c9917f9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1140,6 +1140,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1131,6 +1131,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.exit();
this.methodProfiler.exit();
@ -135,7 +135,7 @@ index 1a75db6f49..fd1b268798 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0afc34ac0e..62098b2fc7 100644
index cfbe3d592..6cd8b8ede 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -19,6 +19,7 @@ import org.apache.logging.log4j.util.Supplier;

View file

@ -1,4 +1,4 @@
From 5619ac14f1e9afb752d7b27d45fdfbdee4aae6c1 Mon Sep 17 00:00:00 2001
From ba19d0291f949d081ce4896fe2c752bbdb812c63 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 19:55:45 -0400
Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
@ -32,10 +32,10 @@ index 469a3be05..f2c429f22 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7b3c4747e..8ce7903a1 100644
index 31c9917f9..85b40ab7e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1105,6 +1105,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1096,6 +1096,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit - dropTickTime
for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) {
WorldServer worldserver = (WorldServer) iterator.next();

View file

@ -1,4 +1,4 @@
From 5e92a471ed8703bfee653687df9ceae4cc07b8db Mon Sep 17 00:00:00 2001
From db6b501790c33110448f91bde8ab710f1905e8bb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 860957c0b1..a3c53d9dbf 100644
index bf8ca326b..50cf32f41 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -61,6 +61,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
@ -25,7 +25,7 @@ index 860957c0b1..a3c53d9dbf 100644
this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
this.ai = new CraftingManager();
@@ -1915,7 +1917,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1906,7 +1908,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Deprecated
public static MinecraftServer getServer() {

View file

@ -1,4 +1,4 @@
From 406817a7fae0de5afda2dd1f6c75b279a75b2ac6 Mon Sep 17 00:00:00 2001
From cb43684f70ce6bf169893e745001addc1087aa05 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
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 099d7218c9..108c8c05e7 100644
index 7b9fcb2c0..851646727 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,10 +41,27 @@
@ -75,7 +75,7 @@ index 099d7218c9..108c8c05e7 100644
<groupId>org.apache.maven.plugins</groupId>
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 0000000000..cd6e259239
index 000000000..cd6e25923
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -0,0 +1,40 @@
@ -121,7 +121,7 @@ index 0000000000..cd6e259239
+}
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 0000000000..685deaa0e5
index 000000000..685deaa0e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
@@ -0,0 +1,17 @@
@ -143,7 +143,7 @@ index 0000000000..685deaa0e5
+
+}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 19e2df3098..3d0cb874d7 100644
index 19e2df309..3d0cb874d 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -83,6 +83,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@ -185,7 +185,7 @@ index 19e2df3098..3d0cb874d7 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 c117e8fa3f..ffe81205b8 100644
index 2ccee100e..cdf162a95 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -50,7 +50,7 @@ import org.apache.commons.lang3.Validate;
@ -225,7 +225,7 @@ index c117e8fa3f..ffe81205b8 100644
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
}
// CraftBukkit end
@@ -940,7 +944,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -930,7 +934,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} finally {
// CraftBukkit start - Restore terminal to original settings
try {
@ -234,7 +234,7 @@ index c117e8fa3f..ffe81205b8 100644
} catch (Exception ignored) {
}
// CraftBukkit end
@@ -1424,7 +1428,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1415,7 +1419,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Override
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
@ -244,7 +244,7 @@ index c117e8fa3f..ffe81205b8 100644
public KeyPair getKeyPair() {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 274e93a25d..9577b537fc 100644
index 3158197cd..b746e7ad3 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -76,8 +76,7 @@ public abstract class PlayerList {
@ -258,7 +258,7 @@ index 274e93a25d..9577b537fc 100644
this.k = new GameProfileBanList(PlayerList.a);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index abbdb1f64e..69f65eec10 100644
index 2f349ff3d..a9fe6c51d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -41,7 +41,6 @@ import java.util.function.Consumer;
@ -284,7 +284,7 @@ index abbdb1f64e..69f65eec10 100644
@Override
public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c5d5121fd9..4aebe53f8a 100644
index c5d5121fd..4aebe53f8 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -13,7 +13,7 @@ import java.util.logging.Logger;
@ -326,7 +326,7 @@ index c5d5121fd9..4aebe53f8a 100644
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
deleted file mode 100644
index fdf2f075e2..0000000000
index fdf2f075e..000000000
--- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
+++ /dev/null
@@ -1,72 +0,0 @@
@ -403,7 +403,7 @@ index fdf2f075e2..0000000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index befcc19f9b..5510266fb1 100644
index befcc19f9..5510266fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
@@ -4,20 +4,31 @@ import java.util.Collections;
@ -486,7 +486,7 @@ index befcc19f9b..5510266fb1 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index 70f8d42992..449e99d1b6 100644
index 70f8d4299..449e99d1b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -17,7 +17,7 @@ public class ServerShutdownThread extends Thread {
@ -500,7 +500,7 @@ index 70f8d42992..449e99d1b6 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
deleted file mode 100644
index f267f99f96..0000000000
index f267f99f9..000000000
--- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
+++ /dev/null
@@ -1,57 +0,0 @@
@ -562,7 +562,7 @@ index f267f99f96..0000000000
- }
-}
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 490a9acc70..08b6bb7f97 100644
index 490a9acc7..08b6bb7f9 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -1,12 +1,11 @@

View file

@ -1,4 +1,4 @@
From 5ff98ccec965dca484d83140ae801e84cb011313 Mon Sep 17 00:00:00 2001
From 57495dc921d915f3ccc76d8c3b55ad9826165fc8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 0000000000..b151a13c1b
index 000000000..b151a13c1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -0,0 +1,280 @@
@ -293,7 +293,7 @@ index 0000000000..b151a13c1b
+}
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 0000000000..25836b975b
index 000000000..25836b975
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
@@ -0,0 +1,30 @@
@ -329,7 +329,7 @@ index 0000000000..25836b975b
+}
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 0000000000..3bcdb8f93f
index 000000000..3bcdb8f93
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
@@ -0,0 +1,17 @@
@ -352,7 +352,7 @@ index 0000000000..3bcdb8f93f
+}
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 0000000000..4b2a67423f
index 000000000..4b2a67423
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -0,0 +1,29 @@
@ -387,7 +387,7 @@ index 0000000000..4b2a67423f
+}
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 0000000000..3aceb0ea8a
index 000000000..3aceb0ea8
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
@@ -0,0 +1,11 @@
@ -403,7 +403,7 @@ index 0000000000..3aceb0ea8a
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index d7dc516e4a..d2019fb74c 100644
index 1f6a12632..6d278a0da 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 d7dc516e4a..d2019fb74c 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 ffe81205b8..c84af46815 100644
index cdf162a95..d909ad682 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1255,7 +1255,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1246,7 +1246,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
DispenserRegistry.init();
DispenserRegistry.c();
String s = "."; // PAIL?
@ -441,7 +441,7 @@ index ffe81205b8..c84af46815 100644
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(s, MinecraftServer.b.getName()));
@@ -1715,6 +1715,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1706,6 +1706,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.H = i;
}
@ -450,7 +450,7 @@ index ffe81205b8..c84af46815 100644
return this.minecraftSessionService;
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 409bc6da9e..9eaf1539f7 100644
index 409bc6da9..9eaf1539f 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -43,7 +43,7 @@ public class UserCache {
@ -486,7 +486,7 @@ index 409bc6da9e..9eaf1539f7 100644
private UserCacheEntry(GameProfile gameprofile, Date date) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4077c54892..08f84e5db8 100644
index 44acc6a5f..cdf3b6b6c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -196,6 +196,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;

View file

@ -1,4 +1,4 @@
From e05161408f34c060a08f1ff90a9bb628d5e1b52a Mon Sep 17 00:00:00 2001
From 83ea81696792e0e9158b42e3e95833939a862d21 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:56:26 +0200
Subject: [PATCH] Implement extended PaperServerListPingEvent
@ -177,7 +177,7 @@ index 000000000..a85466bc7
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1290cff77..ea3d9e9af 100644
index d909ad682..e5b3dc9e2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,6 +1,7 @@
@ -188,7 +188,7 @@ index 1290cff77..ea3d9e9af 100644
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -1055,7 +1056,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1046,7 +1047,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (i - this.Z >= 5000000000L) {
this.Z = i;
this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount()));

View file

@ -1,4 +1,4 @@
From 756307a54e45d15f96f071b2f955c68181f56441 Mon Sep 17 00:00:00 2001
From 9305bed7b7d8a7a5990dc0ac7448d4141a314491 Mon Sep 17 00:00:00 2001
From: miclebrick <miclebrick@outlook.com>
Date: Wed, 8 Aug 2018 15:30:52 -0400
Subject: [PATCH] Add Early Warning Feature to WatchDog
@ -9,7 +9,7 @@ thread dumps at an interval until the point of crash.
This will help diagnose what was going on in that time before the crash.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index d773ef5b0d..833659bbb2 100644
index d773ef5b0..833659bbb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -25,6 +25,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
@ -36,7 +36,7 @@ index d773ef5b0d..833659bbb2 100644
public static int tabSpamLimit = 500;
private static void tabSpamLimiters() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ea3d9e9afa..9b11fd838b 100644
index e5b3dc9e2..35cd6f9bf 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -847,6 +847,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -45,10 +45,10 @@ index ea3d9e9afa..9b11fd838b 100644
// Spigot start
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, wait, tickSection = start; // Paper - Further improve server tick loop
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
lastTick = start - TICK_TIME; // Paper
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4fe8e198f2..770dbf6052 100644
index 4fe8e198f..770dbf605 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -754,6 +754,7 @@ public final class CraftServer implements Server {
@ -68,7 +68,7 @@ index 4fe8e198f2..770dbf6052 100644
@Override
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 6c5430ff94..4b8581f0ed 100644
index 6c5430ff9..4b8581f0e 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -225,7 +225,7 @@ public class SpigotConfig
@ -81,7 +81,7 @@ index 6c5430ff94..4b8581f0ed 100644
public static boolean bungee;
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 9532aada82..a1d93200e6 100644
index 9532aada8..a1d93200e 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -5,6 +5,7 @@ import java.lang.management.MonitorInfo;

View file

@ -1,4 +1,4 @@
From 30231c8e9b612ba94f005574d442dd816b601455 Mon Sep 17 00:00:00 2001
From 8ea741a76d6668e395e1946809378cf1ba23220f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 22:09:52 -0400
Subject: [PATCH] Optimize Hoppers
@ -11,7 +11,7 @@ Subject: [PATCH] Optimize Hoppers
* Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a5b4f99901..2b5402b009 100644
index a5b4f9990..2b5402b00 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -360,6 +360,15 @@ public class PaperWorldConfig {
@ -31,7 +31,7 @@ index a5b4f99901..2b5402b009 100644
private void disableSprintInterruptionOnAttack() {
disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false);
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index ca1bd02995..2d83c9e79c 100644
index ca1bd0299..2d83c9e79 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -482,8 +482,9 @@ public final class ItemStack {
@ -47,10 +47,10 @@ index ca1bd02995..2d83c9e79c 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 9b11fd838b..6a3776091e 100644
index 35cd6f9bf..2ed49dceb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1135,6 +1135,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1126,6 +1126,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) {
WorldServer worldserver = (WorldServer) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
@ -59,7 +59,7 @@ index 9b11fd838b..6a3776091e 100644
if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit
this.methodProfiler.a(() -> {
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 9f31f071bb..6bddb27365 100644
index 9f31f071b..6bddb2736 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -62,6 +62,7 @@ public abstract class TileEntity implements KeyedObject { // Paper
@ -79,7 +79,7 @@ index 9f31f071bb..6bddb27365 100644
this.world.b(this.position, this);
if (!this.c.isAir()) {
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index 0555bae5aa..452e46cad7 100644
index 0555bae5a..452e46cad 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -189,6 +189,153 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi

View file

@ -1,4 +1,4 @@
From c9287ae57a9e0346476aad606cead3bad2dfa3eb Mon Sep 17 00:00:00 2001
From 0f036e29388e637dd6f9297c39b79e3e7f617508 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 0a02dece68..1858e956b5 100644
index 3aa62d13a..e160e72cd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1119,12 +1119,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1110,12 +1110,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in.

View file

@ -1,4 +1,4 @@
From 052028998cb5bca8e8150a97019a6e4b35f06582 Mon Sep 17 00:00:00 2001
From c5119783012dfc7197aeab25b2833d7efe9be2d0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Mar 2019 22:48:45 -0400
Subject: [PATCH] Server Tick Events
@ -6,10 +6,10 @@ 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 1858e956b5..6e77fa35b4 100644
index e160e72cd..13278cc58 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1050,6 +1050,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1041,6 +1041,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
this.slackActivityAccountant.tickStarted(); // Spigot
long i = SystemUtils.getMonotonicNanos();
@ -17,7 +17,7 @@ index 1858e956b5..6e77fa35b4 100644
++this.ticks;
this.b(booleansupplier);
@@ -1096,6 +1097,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1087,6 +1088,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.exit();
org.spigotmc.WatchdogThread.tick(); // Spigot
this.slackActivityAccountant.tickEnded(l); // Spigot

View file

@ -1,4 +1,4 @@
From 3dabcd7c52beadaadbc2858a38b0252c2b8dca51 Mon Sep 17 00:00:00 2001
From 692de124b401ea8b0bd819e0570ec59a05f60a4e Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
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 70f730996..73ac45bf7 100644
index ef850c17e..934f9f7f0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1945,7 +1945,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1936,7 +1936,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit start
@Override
public boolean isMainThread() {