mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-29 23:17:41 +02:00
Change the 'step' detection.
Catch yDistance between step height and minimum jump gain, let vdistrel and vdistsb catch the rest. Use the more precise flags of data.thisMove.
This commit is contained in:
parent
2bb605a497
commit
856e723908
@ -1130,21 +1130,23 @@ public class SurvivalFly extends Check {
|
|||||||
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, inAirChecks(now, from, to, hDistance, yDistance, lastMove, data, cc));
|
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, inAirChecks(now, from, to, hDistance, yDistance, lastMove, data, cc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple-step blocker.
|
// Block 'step' with yDistance between step height and minJumpGain (vdistrel and vdistsb should catch the rest).
|
||||||
// TODO: Complex step blocker: distance to set-back + low jump + accounting info
|
// TODO: Model other cases of unexpectedly low 'jumping', such as using too few velocity?
|
||||||
if ((resetFrom || lastMove.touchedGround) && resetTo && vDistanceAboveLimit <= 0D &&
|
// (Actual step cheats are probably better detected by generalized patterns.)
|
||||||
yDistance > cc.sfStepHeight && yDistance > maxJumpGain + 0.1) {
|
if (vDistanceAboveLimit <= 0D
|
||||||
boolean step = true;
|
&& yDistance > cc.sfStepHeight && yDistance < data.liftOffEnvelope.getMinJumpGain(data.jumpAmplifier)
|
||||||
|
&& !data.thisMove.headObstructed && !data.thisMove.from.resetCond && !data.thisMove.to.resetCond
|
||||||
|
&& (data.thisMove.from.onGround || data.thisMove.touchedGroundWorkaround) && data.thisMove.to.onGround
|
||||||
|
) {
|
||||||
// Exclude a lost-ground case.
|
// Exclude a lost-ground case.
|
||||||
if (data.thisMove.touchedGroundWorkaround && lastMove.toIsValid && lastMove.yDistance <= 0.0 && yDistance > 0.0 &&
|
if (data.thisMove.touchedGroundWorkaround && lastMove.toIsValid && lastMove.yDistance <= 0.0
|
||||||
yDistance + Math.abs(lastMove.yDistance) <= 2.0 * (maxJumpGain + 0.1)) {
|
&& yDistance + Math.abs(lastMove.yDistance) <= 2.0 * (maxJumpGain + 0.1)) {
|
||||||
step = false;
|
// TODO: Review: still needed?
|
||||||
}
|
}
|
||||||
// Check bypass permission last.
|
else {
|
||||||
if (step && !player.hasPermission(Permissions.MOVING_SURVIVALFLY_STEP)) {
|
// Potential violation.
|
||||||
final double vl = Math.max(vDistanceAboveLimit, Math.abs(from.isOnClimbable() ? yDistance : yDistance - (maxJumpGain + 0.1))); // Could adjust if on ladders etc.
|
if (!player.hasPermission(Permissions.MOVING_SURVIVALFLY_STEP) && data.getOrUseVerticalVelocity(yDistance) == null) {
|
||||||
if (vl > 0.0 && data.getOrUseVerticalVelocity(yDistance) == null) {
|
vDistanceAboveLimit = yDistance - cc.sfStepHeight;
|
||||||
vDistanceAboveLimit = vl;
|
|
||||||
tags.add("step");
|
tags.add("step");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user