From 1c22518dd9c029181bf3fa7abfe19c420ffb1a07 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Sun, 3 Mar 2024 18:32:29 +0100 Subject: [PATCH] Lag bar now shows target TPS from /tick command --- .../modules/PerformanceAnalysisManager.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/PerformanceAnalysisManager.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/PerformanceAnalysisManager.java index 2fb4360..812fbec 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/PerformanceAnalysisManager.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/PerformanceAnalysisManager.java @@ -347,19 +347,19 @@ public class PerformanceAnalysisManager implements Listener { : (avgTickDuration1s < 46) ? NamedTextColor.GOLD : NamedTextColor.RED; - timings = text("(Tr:") - .then(text(Math.round(avgTickCPUTime1s) + "ms").color(avgTickCPUTime1sColor)) - .thenText(" Tw:") - .then(text(Math.round(avgTickWaitingTime1s) + "ms").color(avgTickWaitingTime1sColor)) - .thenText(" S:") - .then(text(Math.round(avgInterTickDuration1s) + "ms").color(avgInterTickDuration1sColor)) - .thenText(")"); + timings = text("(R/W/S:") + .then(text(Math.round(avgTickCPUTime1s)).color(avgTickCPUTime1sColor)) + .thenText("/") + .then(text(Math.round(avgTickWaitingTime1s)).color(avgTickWaitingTime1sColor)) + .thenText("/") + .then(text(Math.round(avgInterTickDuration1s)).color(avgInterTickDuration1sColor)) + .thenText("ms)"); } title = infoText("TPS [") .thenLegacyText(s.toString()) .thenText("] ") - .then(text(tps1sDisplay+"/20 ").color(tps1sGradient.pickColorAt(tps1s))) + .then(text(tps1sDisplay + "/" + getTargetTickRate() + " ").color(tps1sGradient.pickColorAt(tps1s))) .then(timings); } @@ -445,6 +445,12 @@ public class PerformanceAnalysisManager implements Listener { return history; } + + + + public static int getTargetTickRate() { + return Math.round(Bukkit.getServerTickManager().getTickRate()); + }