mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
Small changes to reach check, redid aimbot check, improved default config
Prepared for release.
This commit is contained in:
1 parent
67e6f0df62
commit
5c85b8717b
5 files changed
+26
-37
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<Material> predicate) {
|
||||
final ArrayList<Material> materials = new ArrayList<>();
|
||||
for (double x = -0.3; x <= 0.3; x += 0.3) {
|
||||
|
||||
Reference in new issue
Block a user