Add TPSWatcher #62
@ -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 {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren