mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-18 09:51:17 +02: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.
|
// Short term arrivals.
|
||||||
final int tick = TickTask.getTick();
|
final int tick = TickTask.getTick();
|
||||||
if (tick - data.fastPlaceShortTermTick < cc.fastPlaceShortTermTicks){
|
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.
|
// Within range, add.
|
||||||
data.fastPlaceShortTermCount ++;
|
data.fastPlaceShortTermCount ++;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
// Too much lag, reset.
|
||||||
|
data.fastPlaceShortTermTick = tick;
|
||||||
|
data.fastPlaceShortTermCount = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
data.fastPlaceShortTermTick = tick;
|
data.fastPlaceShortTermTick = tick;
|
||||||
data.fastPlaceShortTermCount = 1;
|
data.fastPlaceShortTermCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find if one of both or both are violations:
|
// 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 shortTermViolation = data.fastPlaceShortTermCount - cc.fastPlaceShortTermLimit;
|
||||||
final float violation = Math.max(fullViolation, shortTermViolation);
|
final float violation = Math.max(fullViolation, shortTermViolation);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user