mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
58 lines
3.1 KiB
Diff
58 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Tue, 23 Jul 2019 10:07:16 -0500
|
|
Subject: [PATCH] Lagging threshold
|
|
|
|
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index d61f6cf5a5d3320516339a7078f2e9fb2ab59dfa..18dc66b78f91c0b9efdf9008c0a38c52fdfc93ad 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -329,6 +329,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
|
|
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
|
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
|
|
+ public boolean lagging = false; // Purpur - Lagging threshold
|
|
|
|
public volatile Thread shutdownThread; // Paper
|
|
public volatile boolean abnormalExit = false; // Paper
|
|
@@ -1304,6 +1305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
this.recentTps[0] = tps1.getAverage();
|
|
this.recentTps[1] = tps5.getAverage();
|
|
this.recentTps[2] = tps15.getAverage();
|
|
+ lagging = recentTps[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur - Lagging threshold
|
|
tickSection = currentTime;
|
|
}
|
|
// Paper end - further improve server tick loop
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 3259d5796287f2e7886b5742b25d9f1f1bc22d6d..9d330d5e113a19e705d61a7532832d9decdb64f2 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -3292,4 +3292,10 @@ public final class CraftServer implements Server {
|
|
return this.getProperties().serverName;
|
|
}
|
|
// Purpur end
|
|
+ // Purpur start - Lagging threshold
|
|
+ @Override
|
|
+ public boolean isLagging() {
|
|
+ return getServer().lagging;
|
|
+ }
|
|
+ // Purpur end - Lagging threshold
|
|
}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
index 47ffe5ef0429101414b33a41e91631712a92b32d..bfa985913f3f750a0727a567d3b5951b4d6ed4ca 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
@@ -196,6 +196,11 @@ public class PurpurConfig {
|
|
serverModName = getString("settings.server-mod-name", serverModName);
|
|
}
|
|
|
|
+ public static double laggingThreshold = 19.0D;
|
|
+ private static void tickLoopSettings() {
|
|
+ laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
|
|
+ }
|
|
+
|
|
public static int barrelRows = 3;
|
|
public static boolean enderChestSixRows = false;
|
|
public static boolean enderChestPermissionRows = false;
|