tweaks724/src/main/java/eu/m724/tweaks/module/ping/MsptChecker.java
2025-01-24 10:05:49 +01:00

25 lines
642 B
Java

/*
* Copyright (C) 2025 Minecon724
* Tweaks724 is licensed under the GNU General Public License. See the LICENSE.md file
* in the project root for the full license text.
*/
package eu.m724.tweaks.module.ping;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
public class MsptChecker extends BukkitRunnable {
private long lastLoop = 0;
@Override
public void run() {
long now = System.nanoTime();
PlayerPingStorage.submitNspt((now - lastLoop) / 40);
lastLoop = now;
}
public void init(Plugin plugin) {
this.runTaskTimer(plugin, 0, 40); // 2 secs
}
}