Lag checker and a couple of other fixes

This commit is contained in:
Adam committed 2012-04-15 20:38:42 -04:00
1 parent a1a8b9671c
commit 9e9a35117f
4 files changed
+69 -63

No files matched your search

@@ -10,6 +10,9 @@ import org.bukkit.plugin.java.JavaPlugin;
public class Anticheat extends JavaPlugin {
public ChatManager cm = new ChatManager(this);
private static final Logger l = Logger.getLogger("Minecraft");
private long lastTime = System.currentTimeMillis();
private long time = 0;
public boolean lagged = false;
@Override
public void onDisable() {
@@ -20,6 +23,17 @@ public class Anticheat extends JavaPlugin {
getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
getServer().getPluginManager().registerEvents(new BlockListener(this), this);
getServer().getPluginManager().registerEvents(new EntityListener(this), this);
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
{
public void run()
{
long l = System.currentTimeMillis();
time = l-lastTime;
lastTime = l;
time = time/10;
lagged = time > 1500;
}
}, 200L, 200L);
}
public void log(String s)