12
0

Add TPSWatcher #62

Manuell gemergt
Lixfel hat 9 Commits von TPS nach master 2020-11-07 11:06:32 +01:00 zusammengeführt
Nur Änderungen aus Commit 599755a527 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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) {
Veraltet
Review

Wann wird now < 0?

Wann wird now < 0?
now = 0;
}
tps = now;
}, timeInterval, timeInterval);
}, timeInterval / 50, timeInterval / 50);
}
public enum TPSType {