Added 60s delay to timings enable check.

This commit is contained in:
Jonathan Williams 2015-09-11 23:57:26 -07:00
parent c9971bb117
commit 1417d31b73
2 changed files with 19 additions and 13 deletions

View File

@ -27,6 +27,7 @@ public class LagMeter extends MiniPlugin
private double _ticksPerSecond;
private double _ticksPerSecondAverage;
private long _lastAverage;
private long _start;
private long _lastTick = 0;
@ -43,6 +44,8 @@ public class LagMeter extends MiniPlugin
_clientManager = clientManager;
_lastRun = System.currentTimeMillis();
_lastAverage = System.currentTimeMillis();
_start = System.currentTimeMillis();
}
@EventHandler
@ -94,19 +97,22 @@ public class LagMeter extends MiniPlugin
_count++;
if (_timingsRunning)
if (System.currentTimeMillis() - _start > 60000)
{
if (_ticksPerSecond > 15 || System.currentTimeMillis() - _timingsStarted > 60000)
{
getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings paste");
_timingsRunning = false;
}
}
else if (_ticksPerSecond < 10)
{
_timingsRunning = true;
_timingsStarted = System.currentTimeMillis();
getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings on");
if (_timingsRunning)
{
if (_ticksPerSecond > 15 || System.currentTimeMillis() - _timingsStarted > 60000)
{
getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings paste");
_timingsRunning = false;
}
}
else if (_ticksPerSecond < 10)
{
_timingsRunning = true;
_timingsStarted = System.currentTimeMillis();
getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings on");
}
}
}

View File

@ -11,6 +11,6 @@
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/gson-2.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_60"/>
<classpathentry kind="output" path="bin"/>
</classpath>