Filtered out ping under 0 and over 4000ms, increased ping data gather delay to 15s #684

This commit is contained in:
Rsl1122 2018-08-16 12:19:36 +03:00
parent 12073e9732
commit 23929d73ca
3 changed files with 7 additions and 7 deletions

View File

@ -52,7 +52,7 @@ public class PingMutator {
int max = -1;
for (Ping ping : pings) {
Integer value = ping.getMax();
if (value < 0 || 8000 < value) {
if (value <= 0 || 4000 < value) {
continue;
}
if (value > max) {
@ -67,7 +67,7 @@ public class PingMutator {
int min = -1;
for (Ping ping : pings) {
Integer value = ping.getMin();
if (value < 0 || 8000 < value) {
if (value <= 0 || 4000 < value) {
continue;
}
if (value < min || min == -1) {
@ -80,7 +80,7 @@ public class PingMutator {
public double average() {
return pings.stream().mapToDouble(Ping::getAverage)
.filter(value -> value >= 0 && value <= 8000)
.filter(value -> value > 0 && value <= 4000)
.average().orElse(-1);
}
}

View File

@ -37,7 +37,7 @@ public class PingInsertProcessor implements CriticalRunnable {
long lastDate = history.get(history.size() - 1).getDate();
OptionalInt max = history.stream()
.mapToInt(DateObj::getValue)
.filter(i -> i >= 0)
.filter(i -> i > 0 && i < 4000)
.max();
if (!max.isPresent()) {
@ -46,12 +46,12 @@ public class PingInsertProcessor implements CriticalRunnable {
int minValue = history.stream()
.mapToInt(DateObj::getValue)
.filter(i -> i >= 0)
.filter(i -> i > 0 && i < 4000)
.min().orElse(-1);
double avgValue = history.stream()
.mapToInt(DateObj::getValue)
.filter(i -> i >= 0)
.filter(i -> i > 0 && i < 4000)
.average().orElse(-1);
int maxValue = max.getAsInt();

View File

@ -160,7 +160,7 @@ public class PingCountTimer extends AbsRunnable implements Listener {
addPlayer(player);
}
}
}).runTaskLater(TimeAmount.SECOND.ticks() * 10L);
}).runTaskLater(TimeAmount.SECOND.ticks() * 15L);
}
@EventHandler