From 599755a52775fd072a2a3dcd155facc9ab4dc11c Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 4 Oct 2020 18:18:55 +0200 Subject: [PATCH] Fix TPSWatcher for 10 seconds --- SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java b/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java index 97ad502..5c718cc 100644 --- a/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java +++ b/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java @@ -23,7 +23,6 @@ import org.bukkit.Bukkit; public class TPSWatcher { - private static final double tickTimeDefault = 1000; private static final double tickDefault = 20.0; private static TPSWatcher tps_OneSecond = new TPSWatcher(1000); @@ -34,20 +33,19 @@ public class TPSWatcher { private double tps = 20.0; private TPSWatcher(long timeInterval) { - timeInterval = timeInterval / 50; Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> { long tickTime = System.currentTimeMillis() - lastTime; lastTime = System.currentTimeMillis(); double now = 0; if (tickTime != 0) { - now = (tickTimeDefault / tickTime) * tickDefault; + now = (timeInterval / (double) tickTime) * tickDefault; } if (now < 0) { now = 0; } tps = now; - }, timeInterval, timeInterval); + }, timeInterval / 50, timeInterval / 50); } public enum TPSType {