Metrics/ticks: Use rounding + de-tweak counting up to 20.

This commit is contained in:
asofold 2013-07-09 17:16:47 +02:00
parent 8a3a517da3
commit 543dcf57f5
2 changed files with 4 additions and 4 deletions

View File

@ -477,7 +477,7 @@ public class TickTask implements Runnable {
// Metrics
if (tick > 0 && (tick % 20) == 0){
// Count every second.
final int ticks = Math.min(20, (int) (1000f / (50f * getLag(1000, true))));
final int ticks = Math.min(20, (int) Math.round((1000f / (50f * getLag(1000, true)))));
MetricsData.addTicks(ticks);
}

View File

@ -869,15 +869,15 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
}
});
final Graph serverTicks = metrics.createGraph("Server Ticks");
final int[] ticksArray = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20};
for (final int ticks : ticksArray)
for (int i = 0; i <= 20; i++){
final int ticks = i;
serverTicks.addPlotter(new Plotter(ticks + " tick(s)") {
@Override
public int getValue() {
return MetricsData.getTicks(ticks);
}
});
}
metrics.start();
} catch (final Exception e) {
LogUtil.logWarning("[NoCheatPlus] Failed to initialize metrics:");