mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Completed work on #132, changes to Aimbot check
This commit is contained in:
1 parent
058cf788fd
commit
5c596f5e2f
8 files changed
+34
-89
No files matched your search
@@ -525,27 +525,6 @@ public class Backend {
|
|||||||
return isDoing(player, placedBlock, 0.1);
|
return isDoing(player, placedBlock, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logDamage(final Player player, final int type) {
|
|
||||||
long time;
|
|
||||||
switch (type) {
|
|
||||||
case 1:
|
|
||||||
time = magic.DAMAGE_TIME();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
time = magic.KNOCKBACK_DAMAGE_TIME();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
time = magic.EXPLOSION_DAMAGE_TIME();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
time = magic.DAMAGE_TIME();
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + time);
|
|
||||||
// Only map in which termination time is calculated beforehand.
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logEnterExit(final Player player) {
|
public void logEnterExit(final Player player) {
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.ENTERED_EXITED_TIME());
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.ENTERED_EXITED_TIME());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,17 +50,17 @@ public final class AimbotCheck {
|
|||||||
final float deltaPitch = movementManager.deltaPitch;
|
final float deltaPitch = movementManager.deltaPitch;
|
||||||
final float deltaYaw = movementManager.deltaYaw;
|
final float deltaYaw = movementManager.deltaYaw;
|
||||||
final float pitchAcceleration = Math.abs(deltaPitch - movementManager.lastDeltaPitch);
|
final float pitchAcceleration = Math.abs(deltaPitch - movementManager.lastDeltaPitch);
|
||||||
final float yawAcceleration = Math.abs(deltaYaw - movementManager.lastDeltaYaw);
|
|
||||||
|
|
||||||
if (deltaYaw > 3.0F && deltaPitch <= 10.0F && pitchAcceleration > 2.0F && yawAcceleration > 2.0F
|
|
||||||
&& deltaPitch < deltaYaw) {
|
|
||||||
final double gcd = Utilities.computeGcd(deltaPitch, movementManager.lastDeltaPitch);
|
final double gcd = Utilities.computeGcd(deltaPitch, movementManager.lastDeltaPitch);
|
||||||
final double mod = player.getLocation().getPitch() % gcd;
|
final double mod = Math.abs(player.getLocation().getPitch() % gcd);
|
||||||
final double maxGcd = checksConfig.getDouble(CheckType.AIMBOT, "maxGcd");
|
final double minAcceleration = checksConfig.getDouble(CheckType.AIMBOT, "minAcceleration");
|
||||||
final double maxMod = checksConfig.getDouble(CheckType.AIMBOT, "maxMod");
|
final double maxMod = checksConfig.getDouble(CheckType.AIMBOT, "maxMod");
|
||||||
if (gcd < maxGcd || mod < maxMod) {
|
if (mod < maxMod && pitchAcceleration > minAcceleration
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "failed computational check (gcd=" + gcd + ", mod=" + mod + ")");
|
&& (deltaPitch == 0.0f || (deltaPitch > 45.0f && deltaYaw > 45.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)
|
||||||
|
+ ")");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public final class FlightCheck {
|
|||||||
|
|
||||||
// Start AirFlight
|
// Start AirFlight
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
||||||
&& !velocityTracker.isVelocitized() && movementManager.elytraEffectTicks <= 25) {
|
&& movementManager.elytraEffectTicks <= 25) {
|
||||||
// Config default base is 1200ms
|
// Config default base is 1200ms
|
||||||
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
||||||
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
@@ -102,10 +102,14 @@ public final class FlightCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fixes water false positive
|
// Fixes water false positive
|
||||||
if (Utilities.isNearWater(player) || Utilities.isNearWater(distance.getFrom().clone().subtract(0, 0.51, 0))) {
|
if (Utilities.isNearWater(player)
|
||||||
|
|| Utilities.isNearWater(distance.getFrom().clone().subtract(0, 0.51, 0))) {
|
||||||
maxMotionY += 0.05;
|
maxMotionY += 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Velocity adjustment
|
||||||
|
maxMotionY += velocityTracker.getVertical();
|
||||||
|
|
||||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0
|
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0
|
||||||
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0))
|
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0))
|
||||||
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 0.75, 0))
|
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 0.75, 0))
|
||||||
@@ -136,8 +140,7 @@ public final class FlightCheck {
|
|||||||
&& Math.round(movementManager.motionY * 1000) != 248
|
&& Math.round(movementManager.motionY * 1000) != 248
|
||||||
&& !(Math.round(movementManager.motionY * 1000) == 333
|
&& !(Math.round(movementManager.motionY * 1000) == 333
|
||||||
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
||||||
&& !velocityTracker.isVelocitized()
|
&& !velocityTracker.isVelocitized() && !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
&& (!Utilities.isNearBed(distance.getTo()) || ((Utilities.isNearBed(distance.getTo())
|
&& (!Utilities.isNearBed(distance.getTo()) || ((Utilities.isNearBed(distance.getTo())
|
||||||
@@ -161,8 +164,7 @@ public final class FlightCheck {
|
|||||||
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.airTicks >= minAirTicks
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.airTicks >= minAirTicks
|
||||||
&& movementManager.lastMotionY < 0 && movementManager.motionY > 0
|
&& movementManager.lastMotionY < 0 && movementManager.motionY > 0
|
||||||
&& !velocityTracker.isVelocitized()
|
&& movementManager.motionY > velocityTracker.getVertical() && movementManager.elytraEffectTicks <= 25
|
||||||
&& movementManager.elytraEffectTicks <= 25
|
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
&& !(Math.round(movementManager.motionY * 1000) == 396) && movementManager.airTicks == 15) {
|
&& !(Math.round(movementManager.motionY * 1000) == 396) && movementManager.airTicks == 15) {
|
||||||
@@ -170,9 +172,8 @@ public final class FlightCheck {
|
|||||||
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
|
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movementManager.airTicks >= minAirTicks && movementManager.motionY > 0
|
if (movementManager.airTicks >= minAirTicks && movementManager.motionY > 0 && !velocityTracker.isVelocitized()
|
||||||
&& velocityTracker.getVertical() <= 0.0D && movementManager.slimeInfluenceTicks <= 0
|
&& movementManager.slimeInfluenceTicks <= 0 && movementManager.elytraEffectTicks <= 25
|
||||||
&& movementManager.elytraEffectTicks <= 25
|
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))) {
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||||
@@ -192,7 +193,7 @@ public final class FlightCheck {
|
|||||||
|
|
||||||
// Start Gravity
|
// Start Gravity
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "gravity") && !movementManager.onGround
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "gravity") && !movementManager.onGround
|
||||||
&& movementManager.motionY < 0 && !velocityTracker.isVelocitized()
|
&& movementManager.motionY < 0 && Math.abs(movementManager.motionY) > velocityTracker.getVertical()
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
||||||
&& !Utilities.isNearWeb(player) && movementManager.elytraEffectTicks <= 25
|
&& !Utilities.isNearWeb(player) && movementManager.elytraEffectTicks <= 25
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public final class SpeedCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adjust for velocity
|
// Adjust for velocity
|
||||||
predict += velocityTracker.getHorizontal() * 0.8D;
|
limit += velocityTracker.getHorizontal();
|
||||||
|
|
||||||
if (distanceXZ - predict > limit) {
|
if (distanceXZ - predict > limit) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "AirSpeed",
|
return new CheckResult(CheckResult.Result.FAILED, "AirSpeed",
|
||||||
@@ -233,7 +233,7 @@ public final class SpeedCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add velocity
|
// Add velocity
|
||||||
limit += velocityTracker.getHorizontal() * 0.8D;
|
limit += velocityTracker.getHorizontal();
|
||||||
|
|
||||||
if (initialAcceleration > limit) {
|
if (initialAcceleration > limit) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "AirAcceleration",
|
return new CheckResult(CheckResult.Result.FAILED, "AirAcceleration",
|
||||||
@@ -340,6 +340,9 @@ public final class SpeedCheck {
|
|||||||
limit *= 0.68D;
|
limit *= 0.68D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Velocity adjustment
|
||||||
|
limit += velocityTracker.getHorizontal();
|
||||||
|
|
||||||
if (distanceXZ - limit > 0) {
|
if (distanceXZ - limit > 0) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "GroundSpeed",
|
return new CheckResult(CheckResult.Result.FAILED, "GroundSpeed",
|
||||||
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ", blocking="
|
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ", blocking="
|
||||||
@@ -357,8 +360,10 @@ public final class SpeedCheck {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
final MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager()
|
final User user = AntiCheatReloaded.getManager().getUserManager()
|
||||||
.getUser(player.getUniqueId()).getMovementManager();
|
.getUser(player.getUniqueId());
|
||||||
|
final MovementManager movementManager = user.getMovementManager();
|
||||||
|
final VelocityTracker velocityTracker = user.getVelocityTracker();
|
||||||
// Riptiding exemption
|
// Riptiding exemption
|
||||||
if (movementManager.riptideTicks > 0) {
|
if (movementManager.riptideTicks > 0) {
|
||||||
return PASS;
|
return PASS;
|
||||||
@@ -379,6 +384,9 @@ public final class SpeedCheck {
|
|||||||
maxMotionY *= 1.0525D;
|
maxMotionY *= 1.0525D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust for velocity
|
||||||
|
maxMotionY += velocityTracker.getVertical();
|
||||||
|
|
||||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0) {
|
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "VerticalSpeed",
|
return new CheckResult(CheckResult.Result.FAILED, "VerticalSpeed",
|
||||||
"exceeded vertical speed limit (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
"exceeded vertical speed limit (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||||
|
|||||||
@@ -50,18 +50,6 @@ public interface Magic {
|
|||||||
* Time to exempt a player from moving because of joining the server; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of joining the server; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int JOIN_TIME();
|
public int JOIN_TIME();
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of taking damage; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int DAMAGE_TIME();
|
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of taking damage with knockback effects; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int KNOCKBACK_DAMAGE_TIME();
|
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of taking damage from an explosion; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int EXPLOSION_DAMAGE_TIME();
|
|
||||||
/**
|
/**
|
||||||
* Time a player is considered to have a change in velocity; Type=SYSTEM, Leniency=INCREASE.
|
* Time a player is considered to have a change in velocity; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,10 +19,7 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Creeper;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
@@ -39,7 +36,6 @@ import com.rammelkast.anticheatreloaded.check.CheckType;
|
|||||||
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|
||||||
|
|
||||||
public class EntityListener extends EventListener {
|
public class EntityListener extends EventListener {
|
||||||
|
|
||||||
@@ -114,21 +110,6 @@ public class EntityListener extends EventListener {
|
|||||||
log(result.getMessage(), (Player)e.getDamager(), CheckType.AIMBOT, result.getSubCheck());
|
log(result.getMessage(), (Player)e.getDamager(), CheckType.AIMBOT, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (event.getEntity() instanceof Player) {
|
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
if (e.getDamager() instanceof Player) {
|
|
||||||
Player p = (Player) e.getDamager();
|
|
||||||
getBackend().logDamage(p, 1);
|
|
||||||
int value = VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.KNOCKBACK) ? 2 : 1;
|
|
||||||
getBackend().logDamage(player, value);
|
|
||||||
} else {
|
|
||||||
if (e.getDamager() instanceof TNTPrimed || e.getDamager() instanceof Creeper) {
|
|
||||||
getBackend().logDamage(player, 3);
|
|
||||||
} else {
|
|
||||||
getBackend().logDamage(player, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
|
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
|
||||||
Player player = (Player) e.getDamager();
|
Player player = (Player) e.getDamager();
|
||||||
|
|||||||
@@ -193,10 +193,10 @@ killaura:
|
|||||||
aimbot:
|
aimbot:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Maximum gcd value for check to consider aim illegal
|
# Maximum pitch acceleration for check to consider aim illegal
|
||||||
maxGcd: 0.002
|
minAcceleration: 0.5
|
||||||
# Maximum mod value for check to consider aim illegal
|
# Maximum mod value for check to consider aim illegal
|
||||||
maxMod: 0.003
|
maxMod: 0.0001
|
||||||
# Criticals check settings
|
# Criticals check settings
|
||||||
# Checks if the player tries to do a crit without needed conditions
|
# Checks if the player tries to do a crit without needed conditions
|
||||||
criticals:
|
criticals:
|
||||||
|
|||||||
@@ -8,18 +8,6 @@ TELEPORT_TIME: 1500
|
|||||||
# If your server is slow when a player joins, increasing this value is important
|
# If your server is slow when a player joins, increasing this value is important
|
||||||
# Shouldn't be lower than 1500 or higher than 5000
|
# Shouldn't be lower than 1500 or higher than 5000
|
||||||
JOIN_TIME: 2000
|
JOIN_TIME: 2000
|
||||||
# Time to exempt a player from moving because of taking damage
|
|
||||||
# Can be decreased very slightly to increase detection
|
|
||||||
# Increase in case of false positives after taking damage
|
|
||||||
DAMAGE_TIME: 500
|
|
||||||
# Time to exempt a player from moving because of taking damage with knockback effects
|
|
||||||
# Can be decreased very slightly to increase detection
|
|
||||||
# Increase in case of false positives after knockback
|
|
||||||
KNOCKBACK_DAMAGE_TIME: 2000
|
|
||||||
# Time to exempt a player from moving because of taking damage from an explosion
|
|
||||||
# Can be decreased very slightly to increase detection
|
|
||||||
# Increasing in case of false positives after explosions
|
|
||||||
EXPLOSION_DAMAGE_TIME: 2500
|
|
||||||
# Time a player is considered to have a change in velocity
|
# Time a player is considered to have a change in velocity
|
||||||
VELOCITY_TIME: 1500
|
VELOCITY_TIME: 1500
|
||||||
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
||||||
|
|||||||
Reference in new issue
Block a user