mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-27 10:57:47 +01:00
[Bleeding] Account for server side lag in combined.improbable.
This commit is contained in:
parent
a32a428d08
commit
1b350af75f
@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import fr.neatmonster.nocheatplus.checks.Check;
|
import fr.neatmonster.nocheatplus.checks.Check;
|
||||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
|
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check combines different other checks frequency and occurrecnces into one count.
|
* This check combines different other checks frequency and occurrecnces into one count.
|
||||||
@ -55,13 +56,19 @@ public class Improbable extends Check {
|
|||||||
double violation = 0;
|
double violation = 0;
|
||||||
boolean violated = false;
|
boolean violated = false;
|
||||||
if (shortTerm * 0.8f > cc.improbableLevel / 20.0){
|
if (shortTerm * 0.8f > cc.improbableLevel / 20.0){
|
||||||
violation += shortTerm * 2d;
|
final float lag = cc.lag ? TickTask.getLag(data.improbableCount.bucketDuration(), true) : 1f;
|
||||||
violated = true;
|
if (shortTerm / lag > cc.improbableLevel / 20.0){
|
||||||
|
violation += shortTerm * 2d / lag;
|
||||||
|
violated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final double full = data.improbableCount.score(1.0f);
|
final double full = data.improbableCount.score(1.0f);
|
||||||
if (full > cc.improbableLevel){
|
if (full > cc.improbableLevel){
|
||||||
violation += full;
|
final float lag = cc.lag ? TickTask.getLag(data.improbableCount.bucketDuration() * data.improbableCount.numberOfBuckets(), true) : 1f;
|
||||||
violated = true;
|
if (full / lag > cc.improbableLevel){
|
||||||
|
violation += full / lag;
|
||||||
|
violated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
boolean cancel = false;
|
boolean cancel = false;
|
||||||
if (violated){
|
if (violated){
|
||||||
|
Loading…
Reference in New Issue
Block a user