mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-10-31 07:40:16 +01:00
[Bleeding] Account for server side lag in blockplace.fastplace.
This commit is contained in:
parent
8bb35fec94
commit
65a7bf8b36
@ -49,16 +49,36 @@ public class FastPlace extends Check {
|
||||
// Short term arrivals.
|
||||
final int tick = TickTask.getTick();
|
||||
if (tick - data.fastPlaceShortTermTick < cc.fastPlaceShortTermTicks){
|
||||
// Account for server side lag.
|
||||
if (!cc.lag || TickTask.getLag(50L * (tick - data.fastPlaceShortTermTick), true) < 1.2){
|
||||
// Within range, add.
|
||||
data.fastPlaceShortTermCount ++;
|
||||
}
|
||||
else{
|
||||
// Too much lag, reset.
|
||||
data.fastPlaceShortTermTick = tick;
|
||||
data.fastPlaceShortTermCount = 1;
|
||||
}
|
||||
}
|
||||
else{
|
||||
data.fastPlaceShortTermTick = tick;
|
||||
data.fastPlaceShortTermCount = 1;
|
||||
}
|
||||
|
||||
// Find if one of both or both are violations:
|
||||
final float fullViolation = fullScore - cc.fastPlaceLimit;
|
||||
final float fullViolation;
|
||||
if (fullScore > cc.fastPlaceLimit){
|
||||
// Account for server side lag.
|
||||
if (cc.lag){
|
||||
fullViolation = fullScore / TickTask.getLag(data.fastPlaceBuckets.bucketDuration() * data.fastPlaceBuckets.numberOfBuckets(), true) - cc.fastPlaceLimit;
|
||||
}
|
||||
else{
|
||||
fullViolation = fullScore - cc.fastPlaceLimit;
|
||||
}
|
||||
}
|
||||
else{
|
||||
fullViolation = 0;
|
||||
}
|
||||
final float shortTermViolation = data.fastPlaceShortTermCount - cc.fastPlaceShortTermLimit;
|
||||
final float violation = Math.max(fullViolation, shortTermViolation);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user