diff --git a/pom.xml b/pom.xml index 91ecc9a..4d296e4 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.rammelkast.anticheatreloaded AntiCheatReloaded - 1.10.3-PRE + 1.10.3 AntiCheatReloaded https://www.spigotmc.org/resources/anticheatreloaded.23799/ diff --git a/src/main/java/com/rammelkast/anticheatreloaded/check/combat/KillAuraCheck.java b/src/main/java/com/rammelkast/anticheatreloaded/check/combat/KillAuraCheck.java index 6b9b207..19252ba 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/check/combat/KillAuraCheck.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/check/combat/KillAuraCheck.java @@ -85,11 +85,11 @@ public final class KillAuraCheck { // Velocity compensation final double velocityMultiplier = checksConfig.getDouble(CheckType.KILLAURA, "reach", "velocityMultiplier"); allowedReach += Math.abs(target.getVelocity().length()) * velocityMultiplier; - final double reachedDistance = ((LivingEntity) target).getLocation().toVector() - .distance(player.getLocation().toVector()); - if (reachedDistance > allowedReach) { + final double reachedDistance = Utilities.roundDouble(((LivingEntity) target).getLocation().toVector() + .distance(player.getLocation().toVector()), 2); + if (reachedDistance > Utilities.roundDouble(allowedReach, 2)) { return new CheckResult(CheckResult.Result.FAILED, "Reach", - "reached too far (distance=" + Utilities.roundDouble(reachedDistance, 6) + ", max=" + Utilities.roundDouble(allowedReach, 6) + ")"); + "reached too far (distance=" + reachedDistance + ", max=" + Utilities.roundDouble(allowedReach, 2) + ")"); } return PASS; } diff --git a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/AimbotCheck.java b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/AimbotCheck.java index ad8e021..127eac1 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/AimbotCheck.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/AimbotCheck.java @@ -30,12 +30,9 @@ import com.rammelkast.anticheatreloaded.util.MovementManager; import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.Utilities; -/* - * TODO redo (again) - * Just go for a basic GCD check and implement optifine detection - */ public final class AimbotCheck { + private static final double EXPANDER = Math.pow(2, 24); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); public static CheckResult runCheck(final Player player, final EntityDamageByEntityEvent event) { @@ -49,19 +46,18 @@ public final class AimbotCheck { final MovementManager movementManager = user.getMovementManager(); final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); final float deltaPitch = movementManager.deltaPitch; - final float deltaYaw = movementManager.deltaYaw; final float pitchAcceleration = Math.abs(deltaPitch - movementManager.lastDeltaPitch); - final double gcd = Utilities.computeGcd(deltaPitch, movementManager.lastDeltaPitch); - final double mod = Math.abs(player.getLocation().getPitch() % gcd); + final long gcd = Utilities.getGcd((long) (deltaPitch * EXPANDER), + (long) (movementManager.lastDeltaPitch * EXPANDER)); + final double mod = Math.abs(player.getLocation().getPitch() % (gcd / EXPANDER)); final double minAcceleration = checksConfig.getDouble(CheckType.AIMBOT, "minAcceleration"); final double maxMod = checksConfig.getDouble(CheckType.AIMBOT, "maxMod"); - if (mod < maxMod && pitchAcceleration > minAcceleration - && (deltaPitch == 0.0f || (deltaPitch > 45.0f && deltaYaw > 45.0f))) { + if ((gcd > 0L && gcd < 131072L) && mod <= maxMod && pitchAcceleration > minAcceleration && deltaPitch > 5.0f) { return new CheckResult(CheckResult.Result.FAILED, - "failed computational check (gcd=" + Utilities.roundDouble(gcd, 4) + ", mod=" - + Utilities.roundDouble(mod, 4) + ", accel=" + Utilities.roundDouble(pitchAcceleration, 4) - + ")"); + "failed computational check (gcd=" + gcd + ", mod=" + + Utilities.roundDouble(mod, 5) + ", accel=" + Utilities.roundDouble(pitchAcceleration, 3) + + ", delta=" + Utilities.roundDouble(deltaPitch, 1) + ")"); } return PASS; } diff --git a/src/main/java/com/rammelkast/anticheatreloaded/util/Utilities.java b/src/main/java/com/rammelkast/anticheatreloaded/util/Utilities.java index fd9c627..776a2b4 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/util/Utilities.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/util/Utilities.java @@ -766,22 +766,15 @@ public final class Utilities { /** * Calculates the greatest common divider - * @param a value a - * @param b value b - * @return the greatest common divider of a and b + * + * @param current - The current value + * @param previous - The previous value + * @return - The GCD of those two values */ - public static double computeGcd(final double a, final double b) { - if (a < b) { - return computeGcd(b, a); - } + public static long getGcd(final long current, final long previous) { + return (previous <= 16384L) ? current : getGcd(previous, current % previous); + } - if (Math.abs(b) < 0.001) { - return a; - } else { - return computeGcd(b, a - Math.floor(a / b) * b); - } - } - public static boolean isCollisionPoint(final Location location, final Predicate predicate) { final ArrayList materials = new ArrayList<>(); for (double x = -0.3; x <= 0.3; x += 0.3) { diff --git a/src/main/resources/checks.yml b/src/main/resources/checks.yml index aebcc57..90b8e40 100644 --- a/src/main/resources/checks.yml +++ b/src/main/resources/checks.yml @@ -58,7 +58,7 @@ speed: # Should this part of the check be enabled? enabled: true # Base unadjusted air speed limit - baseLimit: 0.03125 + baseLimit: 0.0315 # Prediction multiplier for custom walk speeds walkSpeedMultiplier: 1.4 # Checks movement acceleration in the air @@ -67,7 +67,7 @@ speed: # Should this part of the check be enabled? enabled: true # Base unadjusted air acceleration limit - baseLimit: 0.3725 + baseLimit: 0.375 # Limit multiplier for custom walk speeds walkSpeedMultiplier: 1.4 # Checks movement acceleration in the air @@ -157,7 +157,7 @@ killaura: # Maximum base reach distances baseMaxValue: # Maximum base reach value - normal: 3.6 + normal: 3.5 # Maximum base reach value when a player has velocity velocitized: 4.0 # Settings for lag compensation @@ -167,7 +167,7 @@ killaura: # Extra allowed reach distance per millisecond of ping pingCompensation: 0.0025 # The multiplier of extra compensation for velocity - velocityMultiplier: 1.2 + velocityMultiplier: 1.3 # Checks if the target it within a players viewing angle # Debugs as 'tried to attack from an illegal angle' angle: @@ -194,9 +194,9 @@ aimbot: # Should this check be enabled? enabled: true # Maximum pitch acceleration for check to consider aim illegal - minAcceleration: 0.5 + minAcceleration: 5.5 # Maximum mod value for check to consider aim illegal - maxMod: 0.0001 + maxMod: 0.001 # Criticals check settings # Checks if the player tries to do a crit without needed conditions criticals: