mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Fixed two WaterWalk falses
This commit is contained in:
1 parent
07f957cf35
commit
4deb8ae0fb
5 files changed
+19
-11
No files matched your search
@@ -100,7 +100,7 @@ public class SpeedCheck {
|
||||
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0)
|
||||
predict *= 1.25D;
|
||||
// Boats sometimes give a false positive
|
||||
if (Utilities.couldBeOnBoat(player, 0.5))
|
||||
if (Utilities.couldBeOnBoat(player, 0.5, true))
|
||||
predict *= 1.25D;
|
||||
// Strafing in air when nearing terminal velocity gives false positives
|
||||
// This fixes the issue but gives hackers some leniency which means we need another check for this
|
||||
|
||||
@@ -50,14 +50,17 @@ public class WaterWalkCheck {
|
||||
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
||||
&& Utilities.isSurroundedByWater(player)
|
||||
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0) || movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ"))
|
||||
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0)
|
||||
|| movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ")
|
||||
&& !movementManager.topSolid && !Utilities.couldBeOnBoat(player, 3, false))
|
||||
return new CheckResult(Result.FAILED,
|
||||
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
|
||||
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
|
||||
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
|
||||
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY"))
|
||||
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY")
|
||||
&& !Utilities.couldBeOnBoat(player, 0.3, false))
|
||||
return new CheckResult(Result.FAILED,
|
||||
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class MovementManager {
|
||||
this.distanceXZ = Math.sqrt(x * x + z * z);
|
||||
|
||||
// Account for standing on boat
|
||||
if (Utilities.couldBeOnBoat(player, 0.25))
|
||||
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
|
||||
this.onGround = true;
|
||||
|
||||
this.touchedGroundThisTick = false;
|
||||
|
||||
@@ -124,17 +124,22 @@ public final class Utilities {
|
||||
}
|
||||
|
||||
public static boolean couldBeOnBoat(Player player) {
|
||||
return couldBeOnBoat(player, 0.35);
|
||||
return couldBeOnBoat(player, 0.35, false);
|
||||
}
|
||||
|
||||
public static boolean couldBeOnBoat(Player player, double range) {
|
||||
public static boolean couldBeOnBoat(Player player, double range, boolean checkY) {
|
||||
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
||||
if (entity instanceof Boat)
|
||||
return true;
|
||||
if (entity instanceof Boat) {
|
||||
if (((Boat) entity).getLocation().getY() < player.getLocation().getY() + 0.25) {
|
||||
return true;
|
||||
} else if (!checkY) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a player could be standing on ice
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user