mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@934cd77 Lifecycle Event System (#9629) PaperMC/Paper@534659e Fix NotNull locales (#10216) PaperMC/Paper@9c04729 Add Arrow/Stinger Removal Time API (#10193) PaperMC/Paper@69b52b4 Check for server JARs in plugin directory (#10228) PaperMC/Paper@cbe62d9 Add Conduit API (#10195) PaperMC/Paper@97c0120 Fix fox drops on death (#8862) PaperMC/Paper@581fb30 itemstack expose tooltip lines (#10185)
58 lines
3.0 KiB
Diff
58 lines
3.0 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/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index c90a488e41ef65b57818cd91403e65e5f5e19cd9..feece6ec8fda944e2fcbf7c59327d0a11d9b2885 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -308,6 +308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
|
|
public static long currentTickLong = 0L; // Paper - track current tick as a long
|
|
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
|
+ public boolean lagging = false; // Purpur
|
|
|
|
public volatile Thread shutdownThread; // Paper
|
|
public volatile boolean abnormalExit = false; // Paper
|
|
@@ -1197,6 +1198,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
|
|
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 b0b8c77473d1e81c753cc657c90d8fbdbdda9570..19a306262a617ea3f72ba117a4e0de5ff6bf9a37 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -3258,5 +3258,10 @@ public final class CraftServer implements Server {
|
|
public String getServerName() {
|
|
return this.getProperties().serverName;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public boolean isLagging() {
|
|
+ return getServer().lagging;
|
|
+ }
|
|
// Purpur end
|
|
}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
index 881c5654f181ea9b66e1cdf3bc3bf46869e8557f..9c5bba0ae119f8d42274455e322530ceb5f67d9b 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
@@ -193,6 +193,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;
|