mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-07 03:02:11 +01:00
Don't count empty ones.
This commit is contained in:
parent
27d35c1208
commit
4ee4e6f08d
@ -69,10 +69,16 @@ public class MorePackets extends Check {
|
|||||||
final float burnScore = (float) idealPackets * (float) data.morePacketsFreq.bucketDuration() / 1000f;
|
final float burnScore = (float) idealPackets * (float) data.morePacketsFreq.bucketDuration() / 1000f;
|
||||||
// Find index.
|
// Find index.
|
||||||
int i;
|
int i;
|
||||||
|
int empty = 0;
|
||||||
boolean used = false;
|
boolean used = false;
|
||||||
for (i = 1; i < data.morePacketsFreq.numberOfBuckets(); i++) {
|
for (i = 1; i < data.morePacketsFreq.numberOfBuckets(); i++) {
|
||||||
if (data.morePacketsFreq.bucketScore(i) > 0f) {
|
if (data.morePacketsFreq.bucketScore(i) > 0f) {
|
||||||
if (used) {
|
if (used) {
|
||||||
|
for (int j = i; j < data.morePacketsFreq.numberOfBuckets(); j ++) {
|
||||||
|
if (data.morePacketsFreq.bucketScore(j) == 0f) {
|
||||||
|
empty += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
used = true;
|
used = true;
|
||||||
@ -82,7 +88,7 @@ public class MorePackets extends Check {
|
|||||||
final double fullCount;
|
final double fullCount;
|
||||||
if (i < data.morePacketsFreq.numberOfBuckets()) {
|
if (i < data.morePacketsFreq.numberOfBuckets()) {
|
||||||
// Assume all following time windows are burnt.
|
// Assume all following time windows are burnt.
|
||||||
final float trailing = Math.max(data.morePacketsFreq.trailingScore(i, 1f), burnScore * (data.morePacketsFreq.numberOfBuckets() - i));
|
final float trailing = Math.max(data.morePacketsFreq.trailingScore(i, 1f), burnScore * (data.morePacketsFreq.numberOfBuckets() - i - empty));
|
||||||
final float leading = data.morePacketsFreq.leadingScore(i, 1f);
|
final float leading = data.morePacketsFreq.leadingScore(i, 1f);
|
||||||
fullCount = leading + trailing;
|
fullCount = leading + trailing;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user