From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 26 Mar 2020 19:06:22 -0500
Subject: [PATCH] Configurable TPS Catchup


diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d9513addae86bd5d2f0c50173318cf4d23ef2128..50f1841e3d5e92d6186db49ac4962c0bac943a8c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1010,7 +1010,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
                     this.a(this::canSleepForTick);
                     this.methodProfiler.exitEnter("nextTickWait");
                     this.X = true;
-                    this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
+                    // Purpur start - tps catchup
+                    if (net.pl3x.purpur.PurpurConfig.tpsCatchup) {
+                        this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
+                    } else {
+                        this.W = this.nextTick = curTime / 1000000L + 50L;
+                    }
+                    // Purpur end - tps catchup
                     this.sleepForTick();
                     this.methodProfiler.exit();
                     this.methodProfiler.b();
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index a2f3c5c81d93814f89a778c8c58d36b416ea1efc..10900ef825f88657f287c8c5b71a89338ba54c11 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -190,4 +190,9 @@ public class PurpurConfig {
         loggerSuppressInitLegacyMaterialError = getBoolean("settings.logger.suppress-init-legacy-material-errors", loggerSuppressInitLegacyMaterialError);
         loggerSuppressIgnoredAdvancementWarnings = getBoolean("settings.logger.suppress-ignored-advancement-warnings", loggerSuppressIgnoredAdvancementWarnings);
     }
+
+    public static boolean tpsCatchup = true;
+    private static void tpsCatchup() {
+        tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup);
+    }
 }
