LoaderRework #175
@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.tpslimit;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
import de.steamwar.bausystem.utils.NMSWrapper;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.core.TPSWatcher;
|
import de.steamwar.core.TPSWatcher;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -42,14 +41,11 @@ public class TPSWarpUtils {
|
|||||||
public static void setTPS(double tps) {
|
public static void setTPS(double tps) {
|
||||||
double d = 50 - (50 / (tps / 20.0));
|
double d = 50 - (50 / (tps / 20.0));
|
||||||
nanoDOffset = Math.max(0, Math.min((long) (d * 1000000), 375000000));
|
nanoDOffset = Math.max(0, Math.min((long) (d * 1000000), 375000000));
|
||||||
if (Core.getVersion() != 15) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (nanoDOffset == 0) {
|
if (nanoDOffset == 0) {
|
||||||
if (bukkitTask == null) return;
|
if (bukkitTask == null) return;
|
||||||
bukkitTask.cancel();
|
bukkitTask.cancel();
|
||||||
bukkitTask = null;
|
bukkitTask = null;
|
||||||
} else if (bukkitTask != null) {
|
} else if (bukkitTask == null) {
|
||||||
bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> nanoOffset += nanoDOffset, 1, 1);
|
bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> nanoOffset += nanoDOffset, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren