mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-12 18:50:50 +01:00
Confine "sprintback" alerts to speeds greater than walking.
This reduces false positives with throwing enderpearls at nearby entities or for horizontal velocity. Missing: Use up horizontal velocity if sprintback is triggered and queued velocity is present.
This commit is contained in:
parent
e97a9297aa
commit
6e2844745c
@ -236,13 +236,14 @@ public class SurvivalFly extends Check {
|
|||||||
|
|
||||||
// Prevent players from sprinting if they're moving backwards.
|
// Prevent players from sprinting if they're moving backwards.
|
||||||
// if (hDistanceAboveLimit <= 0D && sprinting && data.horizontalFreedom <= 0.001D) {
|
// if (hDistanceAboveLimit <= 0D && sprinting && data.horizontalFreedom <= 0.001D) {
|
||||||
if (hDistanceAboveLimit <= 0D && sprinting && data.hVelActive.isEmpty()) {
|
if (hDistanceAboveLimit <= 0D && hDistance > walkSpeed && sprinting && data.hVelActive.isEmpty()) {
|
||||||
final float yaw = from.getYaw();
|
final float yaw = from.getYaw();
|
||||||
if (xDistance < 0D && zDistance > 0D && yaw > 180F && yaw < 270F || xDistance < 0D && zDistance < 0D
|
if (xDistance < 0D && zDistance > 0D && yaw > 180F && yaw < 270F || xDistance < 0D && zDistance < 0D
|
||||||
&& yaw > 270F && yaw < 360F || xDistance > 0D && zDistance < 0D && yaw > 0F && yaw < 90F
|
&& yaw > 270F && yaw < 360F || xDistance > 0D && zDistance < 0D && yaw > 0F && yaw < 90F
|
||||||
|| xDistance > 0D && zDistance > 0D && yaw > 90F && yaw < 180F){
|
|| xDistance > 0D && zDistance > 0D && yaw > 90F && yaw < 180F){
|
||||||
// Assumes permission check to be the heaviest (might be mistaken).
|
// Assumes permission check to be the heaviest (might be mistaken).
|
||||||
if (!player.hasPermission(Permissions.MOVING_SURVIVALFLY_SPRINTING)){
|
if (!player.hasPermission(Permissions.MOVING_SURVIVALFLY_SPRINTING)){
|
||||||
|
// TODO: This should actually trigger use of horizontal velocity and extra buffers (even better: per axis per direction).
|
||||||
hDistanceAboveLimit = Math.max(hDistanceAboveLimit, hDistance);
|
hDistanceAboveLimit = Math.max(hDistanceAboveLimit, hDistance);
|
||||||
tags.add("sprintback"); // Might add it anyway.
|
tags.add("sprintback"); // Might add it anyway.
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user