mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
add prefixes and descriptions
This commit is contained in:
68
patches/server/0017-FEAT-Lagging-threshold.patch
Normal file
68
patches/server/0017-FEAT-Lagging-threshold.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
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] |FEAT| Lagging threshold
|
||||
|
||||
Adds the config option below that lets you determine what level of TPS is considered lagging.
|
||||
|
||||
$-----------------------------$
|
||||
settings:
|
||||
lagging-threshold:
|
||||
default: 19.0
|
||||
description: |-
|
||||
Purpur keeps track of when it is lagging in order to have the ability to change behaviors accordingly.
|
||||
This value is that threshold when you want to consider the server to be lagging.
|
||||
Right now this is only used for the mob.villager.brain-ticks setting
|
||||
$-----------------------------$
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index adb69ec9916304204930a5988569c20e8a8868f9..ce0b5770129d91c7fc1cfa751f9828973444e5fe 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -306,6 +306,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
|
||||
private static final int SAMPLE_INTERVAL = 20; // Paper
|
||||
public final double[] recentTps = new double[ 3 ];
|
||||
+ public boolean lagging = false; // Purpur
|
||||
public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant();
|
||||
// Spigot end
|
||||
public static long currentTickLong = 0L; // Paper
|
||||
@@ -1257,6 +1258,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.recentTps[1] = tps5.getAverage();
|
||||
this.recentTps[2] = tps15.getAverage();
|
||||
// Paper end
|
||||
+ lagging = recentTps[0] < net.pl3x.purpur.PurpurConfig.laggingThreshold; // Purpur
|
||||
tickSection = curTime;
|
||||
}
|
||||
// Spigot end
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index bc5f937e7480d954680c7b9f1d698aff3e28665d..c0e7027ad804d7b801ef8cb94963c113c95735d1 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -188,6 +188,11 @@ public class PurpurConfig {
|
||||
if (!co.aikar.timings.TimingsManager.hiddenConfigs.contains("server-ip")) co.aikar.timings.TimingsManager.hiddenConfigs.add("server-ip");
|
||||
}
|
||||
|
||||
+ 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;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index c4b60be92fec445096e81e9fad106d2a9f635ff2..09530a0caa8c64f27a6fa28c3919fb326e4a31d6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2689,5 +2689,10 @@ public final class CraftServer implements Server {
|
||||
public String getServerName() {
|
||||
return this.getProperties().serverName;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isLagging() {
|
||||
+ return getServer().lagging;
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
Reference in New Issue
Block a user