mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-15 12:01:51 +01:00
[BLEEDING] Attempt to make moving.morepackets less strict.
This commit is contained in:
parent
85a104ed75
commit
e3cdd761ec
@ -65,29 +65,36 @@ public class MorePackets extends Check {
|
|||||||
// Add packet to frequency count.
|
// Add packet to frequency count.
|
||||||
data.morePacketsFreq.add(time, 1f);
|
data.morePacketsFreq.add(time, 1f);
|
||||||
|
|
||||||
// Fill up all "used" time windows (minimum we can do without other events.
|
// Fill up all "used" time windows (minimum we can do without other events).
|
||||||
boolean used = false;
|
|
||||||
final float burnScore = (float) idealPackets * (float) data.morePacketsFreq.bucketDuration() / 1000f;
|
final float burnScore = (float) idealPackets * (float) data.morePacketsFreq.bucketDuration() / 1000f;
|
||||||
for (int i = 1; i < data.morePacketsFreq.numberOfBuckets(); i++) {
|
// Find index.
|
||||||
final float score = data.morePacketsFreq.bucketScore(i);
|
int i;
|
||||||
if (score > 0f) {
|
boolean used = false;
|
||||||
|
for (i = 1; i < data.morePacketsFreq.numberOfBuckets(); i++) {
|
||||||
|
if (data.morePacketsFreq.bucketScore(i) > 0f) {
|
||||||
if (used) {
|
if (used) {
|
||||||
// Burn this one.
|
break;
|
||||||
data.morePacketsFreq.setBucket(i, Math.max(score, burnScore));
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Burn all after this.
|
|
||||||
used = true;
|
used = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final double fullCount;
|
||||||
|
if (i < data.morePacketsFreq.numberOfBuckets() - 1) {
|
||||||
|
// Assume all following time windows are burnt.
|
||||||
|
final float trailing = Math.max(data.morePacketsFreq.trailingScore(1, 1f), burnScore * (data.morePacketsFreq.numberOfBuckets() - (i + 1)));
|
||||||
|
final float leading = data.morePacketsFreq.leadingScore(1, 1f);
|
||||||
|
fullCount = leading + trailing;
|
||||||
|
} else {
|
||||||
|
// All time windows are used.
|
||||||
|
fullCount = data.morePacketsFreq.score(1f);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
final double violation = (double) fullCount - (double) (burnScore * data.morePacketsFreq.numberOfBuckets());
|
||||||
|
|
||||||
// TODO: Burn time windows based on other activity counting [e.g. same resolution ActinFrequency with keep-alive].
|
// TODO: Burn time windows based on other activity counting [e.g. same resolution ActinFrequency with keep-alive].
|
||||||
|
|
||||||
// Compare score to maximum allowed.
|
|
||||||
final float fullCount = data.morePacketsFreq.score(1f);
|
|
||||||
final double violation = (double) fullCount - (double) (data.morePacketsFreq.bucketDuration() * data.morePacketsFreq.numberOfBuckets() * maxPackets / 1000);
|
|
||||||
|
|
||||||
// Player used up buffer, they fail the check.
|
// Player used up buffer, they fail the check.
|
||||||
if (violation > 0.0) {
|
if (violation > 0.0) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user