SteamWar/SpigotCore
Archiviert
13
0

Fix default getTPS() limit on 20 TPS

Dieser Commit ist enthalten in:
jojo 2020-10-30 23:14:56 +01:00
Ursprung 2c76604bb5
Commit 27d1371e7c

Datei anzeigen

@ -69,6 +69,10 @@ public class TPSWatcher {
return getTPS(TPSType.ONE_SECOND);
}
public double getTPSUnlimited() {
return getTPS(TPSType.ONE_SECOND);
}
public double getTPS(TPSType tpsType) {
switch (tpsType) {
case TEN_SECONDS:
@ -85,6 +89,22 @@ public class TPSWatcher {
}
}
public double getTPSUnlimited(TPSType tpsType) {
switch (tpsType) {
case TEN_SECONDS:
return roundUnlimited(tps_TenSecond.tps);
case ONE_MINUTE:
return roundUnlimited(getSpigotTPS()[0]);
case FIVE_MINUTES:
return roundUnlimited(getSpigotTPS()[1]);
case TEN_MINUTES:
return roundUnlimited(getSpigotTPS()[2]);
default:
return roundUnlimited(tps_OneSecond.tps);
}
}
private double[] getSpigotTPS() {
switch (Core.getVersion()) {
case 8:
@ -104,6 +124,10 @@ public class TPSWatcher {
}
private double round(double d) {
return Math.min(Math.round(d * 10) / 10.0, 20);
}
private double roundUnlimited(double d) {
return Math.round(d * 10) / 10.0;
}