mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-28 22:47:32 +02:00
Metrics/ticks: Use rounding + de-tweak counting up to 20.
This commit is contained in:
parent
8a3a517da3
commit
543dcf57f5
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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:");
|
||||
|
Loading…
Reference in New Issue
Block a user