Remove unused fields
Dieser Commit ist enthalten in:
Ursprung
55c5c3bda5
Commit
8bb76d656f
@ -35,11 +35,15 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class CommandTPSLimiter implements CommandExecutor {
|
||||
|
||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
||||
private static double currentTPSLimit = 20;
|
||||
|
||||
private long lastTime = System.nanoTime();
|
||||
private long currentTime = System.nanoTime();
|
||||
|
||||
private static World world = Bukkit.getWorlds().get(0);
|
||||
private double delay = 0;
|
||||
private int loops = 0;
|
||||
private long sleepDelay = 0;
|
||||
|
||||
private BukkitTask tpsLimiter = null;
|
||||
|
||||
@ -96,6 +100,10 @@ public class CommandTPSLimiter implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void tpsLimiter() {
|
||||
delay = 50 * (20 / currentTPSLimit);
|
||||
loops = (int)Math.ceil(delay / 50.0);
|
||||
sleepDelay = (long) delay / loops;
|
||||
|
||||
if (currentTPSLimit == 20) {
|
||||
if (tpsLimiter == null) return;
|
||||
tpsLimiter.cancel();
|
||||
@ -103,12 +111,8 @@ public class CommandTPSLimiter implements CommandExecutor {
|
||||
} else {
|
||||
if (tpsLimiter != null) return;
|
||||
tpsLimiter = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), () -> {
|
||||
VersionedRunnable.call(new VersionedRunnable(() -> TPSLimit_12.createTickCache(world), 8),
|
||||
new VersionedRunnable(() -> TPSLimit_15.createTickCache(world), 14));
|
||||
|
||||
double delay = 50 * (20 / currentTPSLimit);
|
||||
int loops = (int)Math.ceil(delay / 50.0);
|
||||
long sleepDelay = (long) delay / loops;
|
||||
VersionedRunnable.call(new VersionedRunnable(() -> TPSLimit_12.createTickCache(WORLD), 8),
|
||||
new VersionedRunnable(() -> TPSLimit_15.createTickCache(WORLD), 14));
|
||||
|
||||
for (int i = 0; i < loops; i++) {
|
||||
sleepUntilNextTick(sleepDelay);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren