-
-
Notifications
You must be signed in to change notification settings - Fork 347
/
0099-Configurable-TPS-Catchup.patch
47 lines (43 loc) · 2.27 KB
/
0099-Configurable-TPS-Catchup.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 70f0d85f03cee8323f15fec7597f1ef44c1e0e17 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
---
src/main/java/net/minecraft/server/MinecraftServer.java | 7 +++++++
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 142633ddb..8aed5ff43 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -976,6 +976,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.exitEnter("nextTickWait");
this.ac = true;
this.ab = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
+ // Purpur start - tps catchup
+ if (net.pl3x.purpur.PurpurConfig.tpsCatchup) {
+ this.ab = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
+ } else {
+ this.ab = 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 a729e7d20..7bea36213 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -155,6 +155,11 @@ public class PurpurConfig {
useUPnP = getBoolean("settings.upnp-port-forwarding", useUPnP);
}
+ public static boolean tpsCatchup = true;
+ private static void tpsCatchup() {
+ tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup);
+ }
+
public static boolean dontSendUselessEntityPackets = false;
private static void dontSendUselessEntityPackets() {
dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
--
2.24.0