mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-14 03:21:24 +01:00
Let target switching only count with significant yaw changes.
This commit is contained in:
parent
35a9171934
commit
70ce2086ab
@ -21,6 +21,7 @@ public class Angle extends Check {
|
||||
|
||||
public static class AttackLocation {
|
||||
public final double x, y, z;
|
||||
/** Yaw of the attacker. */
|
||||
public final float yaw;
|
||||
public long time;
|
||||
public final UUID damagedId;
|
||||
@ -104,16 +105,20 @@ public class Angle extends Check {
|
||||
continue;
|
||||
}
|
||||
deltaMove += refLoc.distSqLast;
|
||||
deltaYaw += Math.abs(refLoc.yawDiffLast);
|
||||
final double yawDiff = Math.abs(refLoc.yawDiffLast);
|
||||
deltaYaw += yawDiff;
|
||||
deltaTime += refLoc.timeDiff;
|
||||
deltaSwitchTarget += refLoc.idDiffLast ? 1 : 0;
|
||||
if (refLoc.idDiffLast && yawDiff > 30.0) {
|
||||
// TODO: Configurable sensitivity ? Scale with yawDiff?
|
||||
deltaSwitchTarget += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there is enough data present.
|
||||
if (data.angleHits.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
final double n = (double) (data.angleHits.size() - 1);
|
||||
|
||||
// Let's calculate the average move.
|
||||
|
@ -115,7 +115,7 @@ public class FightConfig extends ACheckConfig {
|
||||
public final boolean yawRateCheck;
|
||||
public final boolean cancelDead;
|
||||
public final boolean knockBackVelocityPvP;
|
||||
|
||||
|
||||
/** Maximum latency counted in ticks for the loop checks (reach, direction). */
|
||||
public final long loopMaxLatencyTicks = 15; // TODO: Configurable, sections for players and entities.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user