Started on ACR 1.11.0: Added 3 new KillAura checks (ThroughWalls, RepeatedAim and Variance), added new Speed check (Predict), started added buffer systems to speed checks, improved BoatFly (still needs testing), performance improvements, config changes, fixed Flight false positive, fixed BadPackets false positive, some code reformatting

This commit is contained in:
Rammelkast committed 2022-01-15 16:49:47 +01:00
1 parent 5c85b8717b
commit 031e7b145b
29 files changed
+839 -408

No files matched your search

+5 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.rammelkast.anticheatreloaded</groupId> <groupId>com.rammelkast.anticheatreloaded</groupId>
<artifactId>AntiCheatReloaded</artifactId> <artifactId>AntiCheatReloaded</artifactId>
<version>1.10.3</version> <version>1.11.0-PRE</version>
<name>AntiCheatReloaded</name> <name>AntiCheatReloaded</name>
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url> <url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
<properties> <properties>
@@ -61,6 +61,10 @@
<relocation> <relocation>
<pattern>com.cryptomorin.xseries</pattern> <pattern>com.cryptomorin.xseries</pattern>
<shadedPattern>com.rammelkast.anticheatreloaded.util</shadedPattern> <shadedPattern>com.rammelkast.anticheatreloaded.util</shadedPattern>
</relocation>
<relocation>
<pattern>com.github.juliarn.npc</pattern>
<shadedPattern>com.rammelkast.anticheatreloaded.util.npc</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
<filters> <filters>
@@ -42,13 +42,13 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.event.BlockListener; import com.rammelkast.anticheatreloaded.event.BlockListener;
import com.rammelkast.anticheatreloaded.event.EntityListener; import com.rammelkast.anticheatreloaded.event.EntityListener;
import com.rammelkast.anticheatreloaded.event.InventoryListener; import com.rammelkast.anticheatreloaded.event.InventoryListener;
import com.rammelkast.anticheatreloaded.event.PacketListener;
import com.rammelkast.anticheatreloaded.event.PlayerListener; import com.rammelkast.anticheatreloaded.event.PlayerListener;
import com.rammelkast.anticheatreloaded.event.VehicleListener; import com.rammelkast.anticheatreloaded.event.VehicleListener;
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager; import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
import com.rammelkast.anticheatreloaded.util.PacketListener;
import com.rammelkast.anticheatreloaded.util.UpdateManager; import com.rammelkast.anticheatreloaded.util.UpdateManager;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
import lombok.Getter; import lombok.Getter;
@@ -118,13 +118,10 @@ public final class AntiCheatReloaded extends JavaPlugin {
setupProtocol(); setupProtocol();
Bukkit.getConsoleSender() Bukkit.getConsoleSender()
.sendMessage(PREFIX + ChatColor.GRAY + "Running Minecraft version " + VersionUtil.getVersion() + " " .sendMessage(PREFIX + ChatColor.GRAY + "Running Minecraft version " + VersionLib.getVersion() + " "
+ (VersionUtil.isSupported() ? (ChatColor.GREEN + "(supported)") + (VersionLib.isSupported() ? (ChatColor.GREEN + "(supported)")
: (ChatColor.RED + "(NOT SUPPORTED!)"))); : (ChatColor.RED + "(NOT SUPPORTED!)")));
// Load protocol manager
PacketListener.load(protocolManager);
// Check for Floodgate // Check for Floodgate
if (Bukkit.getPluginManager().getPlugin("Floodgate") != null) { if (Bukkit.getPluginManager().getPlugin("Floodgate") != null) {
floodgateEnabled = true; floodgateEnabled = true;
@@ -184,7 +181,7 @@ public final class AntiCheatReloaded extends JavaPlugin {
metrics.addCustomChart(new SimplePie("nms_version", new Callable<String>() { metrics.addCustomChart(new SimplePie("nms_version", new Callable<String>() {
@Override @Override
public String call() throws Exception { public String call() throws Exception {
return VersionUtil.getVersion(); return VersionLib.getVersion();
} }
})); }));
metrics.addCustomChart(new SimplePie("floodgate_enabled", new Callable<String>() { metrics.addCustomChart(new SimplePie("floodgate_enabled", new Callable<String>() {
@@ -220,6 +217,7 @@ public final class AntiCheatReloaded extends JavaPlugin {
private void setupProtocol() { private void setupProtocol() {
protocolManager = ProtocolLibrary.getProtocolManager(); protocolManager = ProtocolLibrary.getProtocolManager();
protocolManager.addPacketListener(new PacketListener(this));
verboseLog("Hooked into ProtocolLib"); verboseLog("Hooked into ProtocolLib");
} }
@@ -37,6 +37,7 @@ import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck; import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck; import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck; import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck;
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck; import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
import com.rammelkast.anticheatreloaded.check.player.NoFallCheck; import com.rammelkast.anticheatreloaded.check.player.NoFallCheck;
import com.rammelkast.anticheatreloaded.config.Configuration; import com.rammelkast.anticheatreloaded.config.Configuration;
@@ -129,9 +130,13 @@ public class Backend {
ElytraCheck.JUMP_Y_VALUE.remove(uuid); ElytraCheck.JUMP_Y_VALUE.remove(uuid);
KillAuraCheck.ANGLE_FLAGS.remove(uuid); KillAuraCheck.ANGLE_FLAGS.remove(uuid);
KillAuraCheck.PACKETORDER_FLAGS.remove(uuid); KillAuraCheck.PACKETORDER_FLAGS.remove(uuid);
KillAuraCheck.THROUGHWALLS_FLAGS.remove(uuid);
FlightCheck.MOVING_EXEMPT.remove(uuid); FlightCheck.MOVING_EXEMPT.remove(uuid);
NoSlowCheck.LAST_RELEASE.remove(uuid); NoSlowCheck.LAST_RELEASE.remove(uuid);
NoSlowCheck.VIOLATIONS.remove(uuid); NoSlowCheck.VIOLATIONS.remove(uuid);
SpeedCheck.PREDICT_BUFFER.remove(uuid);
SpeedCheck.AIRSPEED_BUFFER.remove(uuid);
SpeedCheck.AIRACCELERATION_BUFFER.remove(uuid);
} }
public Magic getMagic() { public Magic getMagic() {
@@ -22,14 +22,19 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.FluidCollisionMode;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.google.common.collect.EvictingQueue;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckResult.Result; import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
@@ -38,14 +43,23 @@ import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.MovementManager; import com.rammelkast.anticheatreloaded.util.MovementManager;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
public final class KillAuraCheck { public final class KillAuraCheck {
// Angle check // Angle check
public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>(); public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>();
// PacketOrder check // PacketOrder check
public static final Map<UUID, Integer> PACKETORDER_FLAGS = new HashMap<UUID, Integer>(); public static final Map<UUID, Integer> PACKETORDER_FLAGS = new HashMap<UUID, Integer>();
// ThroughWalls check
public static final Map<UUID, Integer> THROUGHWALLS_FLAGS = new HashMap<UUID, Integer>();
private static final double RAY_LENGTH = 4.5;
// Variance check
public static final Map<UUID, EvictingQueue<Float>> FACTOR_MAP = new HashMap<UUID, EvictingQueue<Float>>();
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult checkReach(final Player player, final Entity target) { public static CheckResult checkReach(final Player player, final Entity target) {
@@ -68,7 +82,8 @@ public final class KillAuraCheck {
allowedReach += 1.5D; allowedReach += 1.5D;
} }
// Lag compensation // Lag compensation
final double lagExtraReach = checksConfig.getDouble(CheckType.KILLAURA, "reach", "lagCompensation.lagExtraReach"); final double lagExtraReach = checksConfig.getDouble(CheckType.KILLAURA, "reach",
"lagCompensation.lagExtraReach");
final double pingCompensation = checksConfig.getDouble(CheckType.KILLAURA, "reach", final double pingCompensation = checksConfig.getDouble(CheckType.KILLAURA, "reach",
"lagCompensation.pingCompensation"); "lagCompensation.pingCompensation");
allowedReach += user.getPing() * pingCompensation; allowedReach += user.getPing() * pingCompensation;
@@ -85,11 +100,11 @@ public final class KillAuraCheck {
// Velocity compensation // Velocity compensation
final double velocityMultiplier = checksConfig.getDouble(CheckType.KILLAURA, "reach", "velocityMultiplier"); final double velocityMultiplier = checksConfig.getDouble(CheckType.KILLAURA, "reach", "velocityMultiplier");
allowedReach += Math.abs(target.getVelocity().length()) * velocityMultiplier; allowedReach += Math.abs(target.getVelocity().length()) * velocityMultiplier;
final double reachedDistance = Utilities.roundDouble(((LivingEntity) target).getLocation().toVector() final double reachedDistance = Utilities.roundDouble(
.distance(player.getLocation().toVector()), 2); ((LivingEntity) target).getLocation().toVector().distance(player.getLocation().toVector()), 2);
if (reachedDistance > Utilities.roundDouble(allowedReach, 2)) { if (reachedDistance > Utilities.roundDouble(allowedReach, 2)) {
return new CheckResult(CheckResult.Result.FAILED, "Reach", return new CheckResult(CheckResult.Result.FAILED, "Reach", "reached too far (distance=" + reachedDistance
"reached too far (distance=" + reachedDistance + ", max=" + Utilities.roundDouble(allowedReach, 2) + ")"); + ", max=" + Utilities.roundDouble(allowedReach, 2) + ")");
} }
return PASS; return PASS;
} }
@@ -97,12 +112,12 @@ public final class KillAuraCheck {
public static CheckResult checkAngle(final Player player, final EntityDamageEvent event) { public static CheckResult checkAngle(final Player player, final EntityDamageEvent event) {
final UUID uuid = player.getUniqueId(); final UUID uuid = player.getUniqueId();
final Entity entity = event.getEntity(); final Entity entity = event.getEntity();
// Do not check while in vehicles // Do not check while in vehicles
if (player.getVehicle() != null || entity.getVehicle() != null || VersionUtil.isRiptiding(player)) { if (player.getVehicle() != null || entity.getVehicle() != null || VersionLib.isRiptiding(player)) {
return PASS; return PASS;
} }
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
// Check if enabled // Check if enabled
@@ -149,9 +164,9 @@ public final class KillAuraCheck {
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "packetOrder")) { if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "packetOrder")) {
return PASS; return PASS;
} }
if (user.isLagging() || (System.currentTimeMillis() - movementManager.lastTeleport) <= 100 if (user.isLagging() || (System.currentTimeMillis() - movementManager.lastTeleport) <= 100 || AntiCheatReloaded
|| AntiCheatReloaded.getPlugin().getTPS() < checksConfig.getDouble(CheckType.KILLAURA, "packetOrder", "minimumTps")) { .getPlugin().getTPS() < checksConfig.getDouble(CheckType.KILLAURA, "packetOrder", "minimumTps")) {
return PASS; return PASS;
} }
@@ -166,14 +181,126 @@ public final class KillAuraCheck {
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "vlBeforeFlag"); int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "vlBeforeFlag");
if (flags >= vlBeforeFlag) { if (flags >= vlBeforeFlag) {
PACKETORDER_FLAGS.remove(uuid); PACKETORDER_FLAGS.remove(uuid);
return new CheckResult(Result.FAILED, "PacketOrder", "suspicious packet order (elapsed=" + elapsed + ")"); return new CheckResult(Result.FAILED, "PacketOrder",
"suspicious packet order (elapsed=" + elapsed + ")");
} }
PACKETORDER_FLAGS.put(uuid, flags + 1); PACKETORDER_FLAGS.put(uuid, flags + 1);
} }
return PASS; return PASS;
} }
public static CheckResult checkVariance(final Player player) {
final UUID uuid = player.getUniqueId();
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
final MovementManager movementManager = user.getMovementManager();
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
// Check if enabled
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "variance")) {
return PASS;
}
final int samples = checksConfig.getInteger(CheckType.KILLAURA, "variance", "samples");
if (movementManager.deltaPitch > 0.0f && movementManager.lastDeltaPitch > 0.0f
&& movementManager.deltaYaw > 5.0f) {
final float factor = movementManager.deltaPitch % movementManager.lastDeltaPitch;
final EvictingQueue<Float> queue = FACTOR_MAP.getOrDefault(uuid, EvictingQueue.create(samples));
queue.add(factor);
if (queue.size() >= samples) {
final double variance = Utilities.getVariance(queue);
if (variance < 0.25) {
FACTOR_MAP.put(uuid, queue);
return new CheckResult(Result.FAILED, "Variance",
"had suspicous aim behaviour (variance: " + Utilities.roundDouble(variance, 3) + ")");
}
}
FACTOR_MAP.put(uuid, queue);
}
return PASS;
}
public static CheckResult checkRepeatedAim(final Player player) {
final UUID uuid = player.getUniqueId();
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
final MovementManager movementManager = user.getMovementManager();
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
// Check if enabled
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "repeatedAim")) {
return PASS;
}
final float deltaYaw = movementManager.deltaYaw;
final float lastDeltaYaw = movementManager.lastDeltaYaw;
final float deltaPitch = movementManager.deltaPitch;
final float lastDeltaPitch = movementManager.lastDeltaPitch;
if (deltaYaw > 0.0f && Math.abs(deltaYaw - lastDeltaYaw) < 1e-5 && deltaPitch > 10.0f) {
return new CheckResult(Result.FAILED, "RepeatedAim",
"repeated aim pattern (type=yaw, deltaPitch=" + Utilities.roundFloat(deltaPitch, 1) + ")");
} else if (deltaPitch > 0.0f && Math.abs(deltaPitch - lastDeltaPitch) < 1e-5 && deltaYaw > 12.0f) {
return new CheckResult(Result.FAILED, "RepeatedAim",
"repeated aim pattern (type=pitch, deltaYaw=" + Utilities.roundFloat(deltaYaw, 1) + ")");
}
return PASS;
}
public static CheckResult checkThroughWalls(final Player player, final Entity target) {
final UUID uuid = player.getUniqueId();
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
final MovementManager movementManager = user.getMovementManager();
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
// Check if enabled
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "throughWalls")) {
return PASS;
}
if ((user.isLagging() && checksConfig.getBoolean(CheckType.KILLAURA, "throughWalls", "disableForLagging"))
|| (System.currentTimeMillis() - movementManager.lastTeleport) <= 100 || AntiCheatReloaded.getPlugin()
.getTPS() < checksConfig.getDouble(CheckType.KILLAURA, "throughWalls", "minimumTps")) {
return PASS;
}
if (Math.abs(player.getLocation().getPitch()) > 30.0f) {
return PASS;
}
final Location eyes = player.getEyeLocation().clone();
final World world = player.getWorld();
final double expansion = checksConfig.getDouble(CheckType.KILLAURA, "throughWalls", "expand");
final RayTraceResult result = world.rayTrace(eyes, eyes.getDirection(), RAY_LENGTH, FluidCollisionMode.NEVER,
true, expansion, entity -> entity.equals(target));
if (player.getLocation().toVector().clone().setY(0.0)
.distance(target.getLocation().toVector().clone().setY(0)) <= expansion) {
return PASS;
}
if (result != null) {
final Block block = result.getHitBlock();
final Entity entity = result.getHitEntity();
final double distance = result.getHitPosition().distance(eyes.toVector());
if (entity == null && block != null && distance > 0.3) {
final int flags = THROUGHWALLS_FLAGS.getOrDefault(uuid, 0) + 1;
if (flags > checksConfig.getInteger(CheckType.KILLAURA, "throughWalls", "vlBeforeFlag")) {
THROUGHWALLS_FLAGS.put(uuid, 0);
return new CheckResult(Result.FAILED, "ThroughWalls",
"hit through object (distance: " + Utilities.roundDouble(distance, 2) + ", block: "
+ block.getType().name().toLowerCase() + ", pitch: "
+ Utilities.roundFloat(player.getLocation().getPitch(), 1) + ")");
}
THROUGHWALLS_FLAGS.put(uuid, flags);
} else {
final int flags = THROUGHWALLS_FLAGS.getOrDefault(uuid, 1) - 1;
THROUGHWALLS_FLAGS.put(uuid, flags);
}
} else {
// TODO should be covered by angle & reach check, but maybe continue anyway?
}
return PASS;
}
public static double calculateYawDifference(final Location from, final Location to) { public static double calculateYawDifference(final Location from, final Location to) {
final Location clonedFrom = from.clone(); final Location clonedFrom = from.clone();
final Vector startVector = clonedFrom.toVector(); final Vector startVector = clonedFrom.toVector();
@@ -35,6 +35,10 @@ public final class AimbotCheck {
private static final double EXPANDER = Math.pow(2, 24); private static final double EXPANDER = Math.pow(2, 24);
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
/**
* This falses sometimes?
* TODO we need to check yaw deltas
*/
public static CheckResult runCheck(final Player player, final EntityDamageByEntityEvent event) { public static CheckResult runCheck(final Player player, final EntityDamageByEntityEvent event) {
final Backend backend = AntiCheatReloaded.getManager().getBackend(); final Backend backend = AntiCheatReloaded.getManager().getBackend();
if (backend.isMovingExempt(player)) { if (backend.isMovingExempt(player)) {
@@ -53,7 +57,7 @@ public final class AimbotCheck {
final double mod = Math.abs(player.getLocation().getPitch() % (gcd / EXPANDER)); final double mod = Math.abs(player.getLocation().getPitch() % (gcd / EXPANDER));
final double minAcceleration = checksConfig.getDouble(CheckType.AIMBOT, "minAcceleration"); 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 > 0L && gcd < 131072L) && mod <= maxMod && pitchAcceleration > minAcceleration && deltaPitch > 5.0f) { if ((gcd > 0L && gcd < 131072L) && mod <= maxMod && pitchAcceleration > minAcceleration && deltaPitch > 5.0f && deltaPitch < 20.0f) {
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
"failed computational check (gcd=" + gcd + ", mod=" "failed computational check (gcd=" + gcd + ", mod="
+ Utilities.roundDouble(mod, 5) + ", accel=" + Utilities.roundDouble(pitchAcceleration, 3) + Utilities.roundDouble(mod, 5) + ", accel=" + Utilities.roundDouble(pitchAcceleration, 3)
@@ -35,7 +35,7 @@ import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
import com.rammelkast.anticheatreloaded.config.providers.Checks; import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.MovementManager; import com.rammelkast.anticheatreloaded.util.MovementManager;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
public final class BoatFlyCheck { public final class BoatFlyCheck {
@@ -43,8 +43,8 @@ public final class BoatFlyCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult runCheck(final Player player, final MovementManager movementManager, final Location to) { public static CheckResult runCheck(final Player player, final MovementManager movementManager, final Location to) {
if (movementManager.distanceXZ <= 0 || movementManager.motionY <= 1E-3 if (movementManager.motionY <= 1E-3
|| (System.currentTimeMillis() - movementManager.lastTeleport <= 50) || VersionUtil.isFlying(player) || (System.currentTimeMillis() - movementManager.lastTeleport <= 150) || VersionLib.isFlying(player)
|| !player.isInsideVehicle()) { || !player.isInsideVehicle()) {
return PASS; return PASS;
} }
@@ -30,7 +30,7 @@ import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.providers.Checks; import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
public final class FastLadderCheck { public final class FastLadderCheck {
@@ -42,7 +42,7 @@ public final class FastLadderCheck {
// Liquids are climbable blocks, so we have to add a seperate check // Liquids are climbable blocks, so we have to add a seperate check
if (!Utilities.isClimbableBlock(player.getLocation().getBlock()) if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|| !Utilities.isClimbableBlock(player.getEyeLocation().getBlock()) || !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|| player.getLocation().getBlock().isLiquid() || VersionUtil.isFlying(player)) { || player.getLocation().getBlock().isLiquid() || VersionLib.isFlying(player)) {
return PASS; return PASS;
} }
@@ -36,7 +36,7 @@ import com.rammelkast.anticheatreloaded.util.MovementManager;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VelocityTracker; import com.rammelkast.anticheatreloaded.util.VelocityTracker;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
/** /**
* @author Rammelkast * @author Rammelkast
@@ -47,11 +47,11 @@ public final class FlightCheck {
public static final Map<UUID, Float> GRAVITY_VIOLATIONS = new HashMap<UUID, Float>(); public static final Map<UUID, Float> GRAVITY_VIOLATIONS = new HashMap<UUID, Float>();
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
private static final double GRAVITY_FRICTION = 0.9800000190734863D; private static final double GRAVITY_FRICTION = 0.98f;
public static CheckResult runCheck(final Player player, final Distance distance) { public static CheckResult runCheck(final Player player, final Distance distance) {
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN() if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|| VersionUtil.isFlying(player) || player.getVehicle() != null || VersionLib.isFlying(player) || player.getVehicle() != null
|| AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)) { || AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)) {
// This was a teleport or user is flying/using elytra/in a vehicle, so we don't // This was a teleport or user is flying/using elytra/in a vehicle, so we don't
// care about it. // care about it.
@@ -70,7 +70,7 @@ public final class FlightCheck {
int minAirTicks = 13; int minAirTicks = 13;
if (player.hasPotionEffect(PotionEffectType.JUMP)) { if (player.hasPotionEffect(PotionEffectType.JUMP)) {
minAirTicks += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 3; minAirTicks += VersionLib.getPotionLevel(player, PotionEffectType.JUMP) * 3;
} }
if (movementManager.halfMovementHistoryCounter > 25) { if (movementManager.halfMovementHistoryCounter > 25) {
@@ -125,11 +125,12 @@ public final class FlightCheck {
&& !Utilities.couldBeOnBoat(player) && !Utilities.couldBeOnBoat(player)
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig && (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
.getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports")) .getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports"))
&& !VersionUtil.isSlowFalling(player) && !Utilities.isNearWeb(player) && !VersionLib.isSlowFalling(player) && !Utilities.isNearWeb(player)
&& movementManager.elytraEffectTicks <= 25 && movementManager.elytraEffectTicks <= 25
&& !Utilities.isNearClimbable(distance.getFrom().clone().subtract(0, 0.51D, 0)) && !Utilities.isNearClimbable(distance.getFrom().clone().subtract(0, 0.51D, 0))
&& !Utilities.isNearWater(player) && !Utilities.isNearWater(player)
&& !Utilities.isNearWater(distance.getFrom().clone().subtract(0, 0.51, 0))) { && !Utilities.isNearWater(distance.getFrom().clone().subtract(0, 0.51, 0))
&& velocityTracker.getVertical() == 0.0) {
return new CheckResult(CheckResult.Result.FAILED, "AirFlight", "had too little Y dropoff (diff=" return new CheckResult(CheckResult.Result.FAILED, "AirFlight", "had too little Y dropoff (diff="
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")"); + Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
} }
@@ -229,7 +230,7 @@ public final class FlightCheck {
&& (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
&& !VersionUtil.isSlowFalling(player)) { && !VersionLib.isSlowFalling(player)) {
final double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION; final double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
final double offset = Math.abs(gravitatedY - movementManager.motionY); final double offset = Math.abs(gravitatedY - movementManager.motionY);
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset"); double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
@@ -39,6 +39,11 @@ public final class NoSlowCheck {
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>(); public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
public static void runCheck(final Player player, final PacketEvent event) { public static void runCheck(final Player player, final PacketEvent event) {
if (event.isCancelled()) {
// Do not check if cancelled
return;
}
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.NOSLOW)) { if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.NOSLOW)) {
return; return;
} }
@@ -18,6 +18,10 @@
*/ */
package com.rammelkast.anticheatreloaded.check.movement; package com.rammelkast.anticheatreloaded.check.movement;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@@ -30,34 +34,99 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.Backend; import com.rammelkast.anticheatreloaded.check.Backend;
import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
import com.rammelkast.anticheatreloaded.config.providers.Checks; import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.Distance; import com.rammelkast.anticheatreloaded.util.Distance;
import com.rammelkast.anticheatreloaded.util.Friction;
import com.rammelkast.anticheatreloaded.util.MovementManager; import com.rammelkast.anticheatreloaded.util.MovementManager;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VelocityTracker; import com.rammelkast.anticheatreloaded.util.VelocityTracker;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
/** /**
* @author Rammelkast TODO soulsand speed TODO buffer system * @author Rammelkast TODO soulsand speed TODO buffer system for all
*/ */
public final class SpeedCheck { public final class SpeedCheck {
public static final Map<UUID, Double> PREDICT_BUFFER = new HashMap<>();
public static final Map<UUID, Double> AIRSPEED_BUFFER = new HashMap<>();
public static final Map<UUID, Double> AIRACCELERATION_BUFFER = new HashMap<>();
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
private static boolean isSpeedExempt(final Player player, final Backend backend) { private static boolean isSpeedExempt(final Player player, final Backend backend) {
return backend.isMovingExempt(player) || VersionUtil.isFlying(player); return backend.isMovingExempt(player) || VersionLib.isFlying(player);
} }
public static CheckResult checkXZSpeed(final Player player, final double x, final double z, /**
final Location movingTowards) { * Largely based on Elevated's Frequency speed check
* @see https://github.com/ElevatedDev/Frequency/blob/master/src/main/java/xyz/elevated/frequency/check/impl/speed/Speed.java
*/
public static CheckResult checkPredict(final Player player, final Location movingTowards) {
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "predict")) {
return PASS;
}
final Backend backend = AntiCheatReloaded.getManager().getBackend();
if (isSpeedExempt(player, backend) || player.getVehicle() != null || Utilities.isInWater(player)
|| Utilities.isInWeb(player)) {
return PASS;
}
final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
final UUID uuid = player.getUniqueId();
final MovementManager movementManager = user.getMovementManager();
final VelocityTracker velocityTracker = user.getVelocityTracker();
final double motion = movementManager.distanceXZ;
final boolean sprinting = true; // TODO do this using packets
double buffer = PREDICT_BUFFER.getOrDefault(uuid, 0.0);
double movementSpeed = Utilities.getMovementSpeed(player);
if (movementManager.wasOnGround) {
if (sprinting) {
movementSpeed *= 1.3f;
}
movementSpeed *= 0.16277136 / Math.pow((movementManager.friction *= 0.91f), 3);
if (!movementManager.onGround && movementManager.motionY >= 0.42f && sprinting) {
movementSpeed += 0.2f;
}
} else {
movementSpeed = sprinting ? 0.026f : 0.02f;
movementManager.friction = 0.91f;
}
movementSpeed += velocityTracker.getHorizontal();
final double factor = (motion - movementManager.adjusted) / movementSpeed;
if (factor > 1.001) {
if (buffer++ > 2.5) {
buffer /= 2;
PREDICT_BUFFER.put(uuid, buffer);
return new CheckResult(Result.FAILED, "Predict", "moved unexpectedly (factor=" + Utilities.roundDouble(factor, 3) + ")");
}
} else {
buffer = Math.max(buffer - 0.05, 0.0);
}
PREDICT_BUFFER.put(uuid, buffer);
movementManager.adjusted = motion * movementManager.friction;
movementManager.friction = Friction.getFactor(movingTowards.clone().subtract(0, 1, 0).getBlock());
return PASS;
}
public static CheckResult checkXZSpeed(final Player player, final Location movingTowards) {
final Backend backend = AntiCheatReloaded.getManager().getBackend(); final Backend backend = AntiCheatReloaded.getManager().getBackend();
if (isSpeedExempt(player, backend) || player.getVehicle() != null || Utilities.isInWater(player)) { if (isSpeedExempt(player, backend) || player.getVehicle() != null || Utilities.isInWater(player)) {
return PASS; return PASS;
} }
final User user = AntiCheatReloaded.getManager().getUserManager() final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
.getUser(player.getUniqueId()); final UUID uuid = player.getUniqueId();
final MovementManager movementManager = user.getMovementManager(); final MovementManager movementManager = user.getMovementManager();
final VelocityTracker velocityTracker = user.getVelocityTracker(); final VelocityTracker velocityTracker = user.getVelocityTracker();
@@ -65,6 +134,7 @@ public final class SpeedCheck {
if (movementManager.riptideTicks > 0) { if (movementManager.riptideTicks > 0) {
return PASS; return PASS;
} }
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
final double distanceXZ = movementManager.distanceXZ; final double distanceXZ = movementManager.distanceXZ;
final boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid; final boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
@@ -72,6 +142,8 @@ public final class SpeedCheck {
// AirSpeed // AirSpeed
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1 if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1
&& movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) { && movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) {
double buffer = AIRSPEED_BUFFER.getOrDefault(uuid, 0.0);
final double multiplier = 0.985D; final double multiplier = 0.985D;
double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1); double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
// Prevents false when falling from great heights // Prevents false when falling from great heights
@@ -119,13 +191,13 @@ public final class SpeedCheck {
// Adjust for soul speed // Adjust for soul speed
final ItemStack boots = player.getInventory().getBoots(); final ItemStack boots = player.getInventory().getBoots();
if (boots != null && movementManager.soilInfluenceTicks > 0 && VersionUtil.isSoulSpeed(boots)) { if (boots != null && movementManager.soilInfluenceTicks > 0 && VersionLib.isSoulSpeed(boots)) {
predict += boots.getEnchantmentLevel(Enchantment.SOUL_SPEED) * 0.05D; predict += boots.getEnchantmentLevel(Enchantment.SOUL_SPEED) * 0.05D;
} }
// Adjust for speed effects // Adjust for speed effects
if (movementManager.hasSpeedEffect) { if (movementManager.hasSpeedEffect) {
predict += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D; predict += VersionLib.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D;
} }
// Adjust for speed effects ending // Adjust for speed effects ending
@@ -135,7 +207,7 @@ public final class SpeedCheck {
// Adjust for jump boost effects // Adjust for jump boost effects
if (player.hasPotionEffect(PotionEffectType.JUMP)) { if (player.hasPotionEffect(PotionEffectType.JUMP)) {
predict += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.05D; predict += VersionLib.getPotionLevel(player, PotionEffectType.JUMP) * 0.05D;
} }
// Adjust for custom walking speed // Adjust for custom walking speed
@@ -166,7 +238,7 @@ public final class SpeedCheck {
} }
// Players can move faster in air with slow falling // Players can move faster in air with slow falling
if (VersionUtil.isSlowFalling(player)) { if (VersionLib.isSlowFalling(player)) {
predict *= 1.25D; predict *= 1.25D;
} }
@@ -183,24 +255,32 @@ public final class SpeedCheck {
&& movementManager.motionY < -0.18 && movementManager.motionY > -0.182) { && movementManager.motionY < -0.18 && movementManager.motionY > -0.182) {
predict += Math.abs(movementManager.motionY); predict += Math.abs(movementManager.motionY);
} }
// Adjust for velocity // Adjust for velocity
limit += velocityTracker.getHorizontal(); limit += velocityTracker.getHorizontal();
if (distanceXZ - predict > limit) { if (distanceXZ - predict > limit) {
return new CheckResult(CheckResult.Result.FAILED, "AirSpeed", if (buffer++ > 1.5) {
"moved too fast in air (speed=" + distanceXZ + ", limit=" + predict + ", block=" buffer /= 2;
+ movementManager.blockingTicks + ", box=" + boxedIn + ", at=" AIRSPEED_BUFFER.put(uuid, buffer);
+ movementManager.airTicks + ")"); return new CheckResult(CheckResult.Result.FAILED, "AirSpeed",
"moved too fast in air (speed=" + Utilities.roundDouble(distanceXZ, 4) + ", limit="
+ Utilities.roundDouble(predict, 4) + ", block=" + movementManager.blockingTicks
+ ", box=" + boxedIn + ", at=" + movementManager.airTicks + ")");
}
} else {
buffer = Math.max(buffer - 0.05, 0.0);
} }
AIRSPEED_BUFFER.put(uuid, buffer);
} }
// AirAcceleration // AirAcceleration
// As of right now, this falses sometimes, dont know why
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airAcceleration") && movementManager.airTicks > 1 if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airAcceleration") && movementManager.airTicks > 1
&& movementManager.iceInfluenceTicks <= 0 && movementManager.slimeInfluenceTicks <= 0 && movementManager.iceInfluenceTicks <= 0 && movementManager.slimeInfluenceTicks <= 0
&& movementManager.elytraEffectTicks <= 0) { && movementManager.elytraEffectTicks <= 0) {
final double initialAcceleration = movementManager.acceleration; final double initialAcceleration = movementManager.acceleration;
double buffer = AIRACCELERATION_BUFFER.getOrDefault(uuid, 0.0);
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725 double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
// Slight increase when boxed in // Slight increase when boxed in
if (boxedIn) { if (boxedIn) {
@@ -209,13 +289,13 @@ public final class SpeedCheck {
// Adjust for soul speed // Adjust for soul speed
final ItemStack boots = player.getInventory().getBoots(); final ItemStack boots = player.getInventory().getBoots();
if (boots != null && movementManager.soilInfluenceTicks > 0 && VersionUtil.isSoulSpeed(boots)) { if (boots != null && movementManager.soilInfluenceTicks > 0 && VersionLib.isSoulSpeed(boots)) {
limit += boots.getEnchantmentLevel(Enchantment.SOUL_SPEED) * 0.025D; limit += boots.getEnchantmentLevel(Enchantment.SOUL_SPEED) * 0.025D;
} }
// Adjust for speed effects // Adjust for speed effects
if (player.hasPotionEffect(PotionEffectType.SPEED)) { if (player.hasPotionEffect(PotionEffectType.SPEED)) {
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D; limit += VersionLib.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D;
} }
// Adjust for slabs // Adjust for slabs
@@ -232,14 +312,23 @@ public final class SpeedCheck {
if (Utilities.couldBeOnBoat(player)) { if (Utilities.couldBeOnBoat(player)) {
limit *= 1.25D; limit *= 1.25D;
} }
// Add velocity // Add velocity
limit += velocityTracker.getHorizontal(); limit += velocityTracker.getHorizontal();
if (initialAcceleration > limit) { if (initialAcceleration > limit) {
return new CheckResult(CheckResult.Result.FAILED, "AirAcceleration", if (buffer++ > 1.5) {
"exceeded acceleration limits (acceleration=" + initialAcceleration + ", max=" + limit + ")"); buffer /= 2;
AIRACCELERATION_BUFFER.put(uuid, buffer);
return new CheckResult(CheckResult.Result.FAILED, "AirAcceleration",
"exceeded acceleration limits (acceleration=" + Utilities.roundDouble(initialAcceleration, 4)
+ ", max=" + Utilities.roundDouble(limit, 4) + ")");
}
} else {
buffer = Math.max(buffer - 0.05, 0.0);
} }
AIRACCELERATION_BUFFER.put(uuid, buffer);
} }
// JumpBehaviour // JumpBehaviour
@@ -247,8 +336,7 @@ public final class SpeedCheck {
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "jumpBehaviour") && movementManager.touchedGroundThisTick if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "jumpBehaviour") && movementManager.touchedGroundThisTick
&& !boxedIn && movementManager.slimeInfluenceTicks <= 10 && !Utilities.isNearHalfblock(movingTowards) && !boxedIn && movementManager.slimeInfluenceTicks <= 10 && !Utilities.isNearHalfblock(movingTowards)
&& !Utilities.isNearHalfblock(movingTowards.clone().subtract(0, 0.51, 0)) && !Utilities.isNearHalfblock(movingTowards.clone().subtract(0, 0.51, 0))
&& !Utilities.couldBeOnBoat(player, 0.8, false) && !Utilities.couldBeOnBoat(player, 0.8, false) && movementManager.elytraEffectTicks <= 0) {
&& movementManager.elytraEffectTicks <= 0) {
// This happens naturally // This happens naturally
if (movementManager.airTicksBeforeGrounded == movementManager.groundTicks) { if (movementManager.airTicksBeforeGrounded == movementManager.groundTicks) {
final double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default final double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default
@@ -261,7 +349,8 @@ public final class SpeedCheck {
} }
// GroundSpeed // GroundSpeed
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "groundSpeed") && movementManager.groundTicks > 1 && movementManager.elytraEffectTicks < 10) { if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "groundSpeed") && movementManager.groundTicks > 1
&& movementManager.elytraEffectTicks < 10) {
final double initialLimit = checksConfig.getDouble(CheckType.SPEED, "groundSpeed", "initialLimit"); // Default final double initialLimit = checksConfig.getDouble(CheckType.SPEED, "groundSpeed", "initialLimit"); // Default
// 0.34 // 0.34
double limit = initialLimit - 0.0055 * Math.min(9, movementManager.groundTicks); double limit = initialLimit - 0.0055 * Math.min(9, movementManager.groundTicks);
@@ -287,7 +376,7 @@ public final class SpeedCheck {
// Adjust for speed effects // Adjust for speed effects
if (movementManager.hasSpeedEffect) { if (movementManager.hasSpeedEffect) {
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.06D; limit += VersionLib.getPotionLevel(player, PotionEffectType.SPEED) * 0.06D;
} }
if (movementManager.hasSpeedEffect && movementManager.groundTicks > 3) { if (movementManager.hasSpeedEffect && movementManager.groundTicks > 3) {
limit *= 1.4D; limit *= 1.4D;
@@ -331,24 +420,23 @@ public final class SpeedCheck {
} }
// Prevent NoWeb // Prevent NoWeb
// TODO config
if (Utilities.isInWeb(player)) { if (Utilities.isInWeb(player)) {
limit *= 0.65D; limit *= 0.65D;
} }
// Sneak speed check // Sneak speed check
// TODO config
if (movementManager.sneakingTicks > 1) { if (movementManager.sneakingTicks > 1) {
limit *= 0.68D; limit *= 0.68D;
} }
// Velocity adjustment // Velocity adjustment
limit += velocityTracker.getHorizontal(); 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=" + Utilities.roundDouble(distanceXZ, 4) + ", limit="
+ player.isBlocking() + ", gt=" + movementManager.groundTicks + ")"); + Utilities.roundDouble(limit, 4) + ", blocking=" + player.isBlocking() + ", gt="
+ movementManager.groundTicks + ")");
} }
} }
@@ -362,8 +450,7 @@ public final class SpeedCheck {
return PASS; return PASS;
} }
final User user = AntiCheatReloaded.getManager().getUserManager() final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
.getUser(player.getUniqueId());
final MovementManager movementManager = user.getMovementManager(); final MovementManager movementManager = user.getMovementManager();
final VelocityTracker velocityTracker = user.getVelocityTracker(); final VelocityTracker velocityTracker = user.getVelocityTracker();
// Riptiding exemption // Riptiding exemption
@@ -385,18 +472,19 @@ public final class SpeedCheck {
if (movementManager.nearLiquidTicks > 6) { if (movementManager.nearLiquidTicks > 6) {
maxMotionY *= 1.0525D; maxMotionY *= 1.0525D;
} }
// Adjust for powdered snow // Adjust for powdered snow
if (distance.getFrom().getBlock().getType() == XMaterial.POWDER_SNOW.parseMaterial()) { if (distance.getFrom().getBlock().getType() == XMaterial.POWDER_SNOW.parseMaterial()) {
maxMotionY += 0.17D; maxMotionY += 0.17D;
} }
// Adjust for velocity // Adjust for velocity
maxMotionY += velocityTracker.getVertical(); 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=" + Utilities.roundDouble(movementManager.motionY, 4) + ", max="
+ Utilities.roundDouble(maxMotionY, 4) + ")");
} }
return PASS; return PASS;
} }
@@ -404,16 +492,13 @@ public final class SpeedCheck {
private static double getMaxAcceptableMotionY(final Player player, final boolean nearBed, private static double getMaxAcceptableMotionY(final Player player, final boolean nearBed,
final boolean couldBeOnBoat, final boolean fromClimbable, final boolean halfMovement, final boolean couldBeOnBoat, final boolean fromClimbable, final boolean halfMovement,
final Checks checksConfig) { final Checks checksConfig) {
// TODO config for these values
// TODO something funky vanilla stuff going on with 0.42, like 0.445.., check
// this..
double base = couldBeOnBoat ? 0.6f : (nearBed ? 0.5625f : ((halfMovement) ? 0.6f : 0.42f)); double base = couldBeOnBoat ? 0.6f : (nearBed ? 0.5625f : ((halfMovement) ? 0.6f : 0.42f));
if (fromClimbable) { if (fromClimbable) {
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04 base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
} }
if (player.hasPotionEffect(PotionEffectType.JUMP)) { if (player.hasPotionEffect(PotionEffectType.JUMP)) {
base += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.2D; base += VersionLib.getPotionLevel(player, PotionEffectType.JUMP) * 0.2D;
} }
return base; return base;
} }
@@ -32,7 +32,7 @@ import com.rammelkast.anticheatreloaded.util.MovementManager;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VelocityTracker; import com.rammelkast.anticheatreloaded.util.VelocityTracker;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
/** /**
* *
@@ -46,24 +46,23 @@ public final class StrafeCheck {
public static CheckResult runCheck(final Player player, final double x, final double z, final Location from, public static CheckResult runCheck(final Player player, final double x, final double z, final Location from,
final Location to) { final Location to) {
if (!Utilities.cantStandAtExp(from) || !Utilities.cantStandAtExp(to) || Utilities.isNearWater(player) if (!Utilities.cantStandAtExp(from) || !Utilities.cantStandAtExp(to) || Utilities.isNearWater(player)
|| Utilities.isNearClimbable(player) || VersionUtil.isFlying(player) || player.isDead() || Utilities.isNearClimbable(player) || VersionLib.isFlying(player) || player.isDead()
|| Utilities.isHalfblock(to.getBlock().getRelative(BlockFace.DOWN)) || Utilities.isNearHalfblock(to)) { || Utilities.isHalfblock(to.getBlock().getRelative(BlockFace.DOWN)) || Utilities.isNearHalfblock(to)) {
return PASS; return PASS;
} }
final User user = AntiCheatReloaded.getManager().getUserManager() final User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
.getUser(player.getUniqueId());
final MovementManager movementManager = user.getMovementManager(); final MovementManager movementManager = user.getMovementManager();
final VelocityTracker velocityTracker = user.getVelocityTracker(); final VelocityTracker velocityTracker = user.getVelocityTracker();
if (velocityTracker.isVelocitized()) { if (velocityTracker.isVelocitized()) {
return PASS; return PASS;
} }
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
if (System.currentTimeMillis() - movementManager.lastTeleport <= checksConfig.getInteger(CheckType.STRAFE, if (System.currentTimeMillis() - movementManager.lastTeleport <= checksConfig.getInteger(CheckType.STRAFE,
"accountForTeleports") || movementManager.elytraEffectTicks >= 20 "accountForTeleports") || movementManager.elytraEffectTicks >= 20
|| movementManager.halfMovementHistoryCounter >= 20 || Utilities.couldBeOnBoat(player, 0.5d, false)) { || movementManager.halfMovementHistoryCounter >= 20 || Utilities.couldBeOnBoat(player, 0.5, false)) {
return PASS; return PASS;
} }
@@ -32,7 +32,7 @@ import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.MovementManager; import com.rammelkast.anticheatreloaded.util.MovementManager;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
public final class WaterWalkCheck { public final class WaterWalkCheck {
@@ -44,7 +44,7 @@ public final class WaterWalkCheck {
final MovementManager movementManager = user.getMovementManager(); final MovementManager movementManager = user.getMovementManager();
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player) || Utilities.isOnCarpet(player) if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player) || Utilities.isOnCarpet(player)
|| movementManager.riptideTicks > 0 || VersionUtil.isSwimming(player) || VersionUtil.isFlying(player) || user.getVelocityTracker().isVelocitized()) { || movementManager.riptideTicks > 0 || VersionLib.isSwimming(player) || VersionLib.isFlying(player) || user.getVelocityTracker().isVelocitized()) {
return PASS; return PASS;
} }
@@ -68,7 +68,7 @@ public final class WaterWalkCheck {
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")"); "tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
} }
final double minAbsMotionY = 0.12D + (VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D); final double minAbsMotionY = 0.12D + (VersionLib.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D);
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid() if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid()
&& Utilities.isSurroundedByWater(player) && Utilities.isSurroundedByWater(player)
&& Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY && Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY
@@ -36,6 +36,11 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
public final class BadPacketsCheck { public final class BadPacketsCheck {
public static void runCheck(final Player player, final PacketEvent event) { public static void runCheck(final Player player, final PacketEvent event) {
if (event.isCancelled()) {
// Do not check if cancelled
return;
}
final Backend backend = AntiCheatReloaded.getManager().getBackend(); final Backend backend = AntiCheatReloaded.getManager().getBackend();
// Confirm if we should even check for BadPackets // Confirm if we should even check for BadPackets
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS) if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS)
@@ -48,7 +53,7 @@ public final class BadPacketsCheck {
final float pitch = packet.getFloat().read(1); final float pitch = packet.getFloat().read(1);
// Check for derp // Check for derp
if (Math.abs(pitch) > 90) { if (Math.abs(pitch) > 90) {
flag(player, event, "had an illegal pitch"); flag(player, event, "had an illegal pitch", null);
return; return;
} }
@@ -78,27 +83,24 @@ public final class BadPacketsCheck {
if (distanceHorizontal > maxDistanceHorizontal) { if (distanceHorizontal > maxDistanceHorizontal) {
flag(player, event, flag(player, event,
"moved too far between packets (HT, distance=" + Utilities.roundDouble(distanceHorizontal, 1) "moved too far between packets (HT, distance=" + Utilities.roundDouble(distanceHorizontal, 1)
+ ", max=" + Utilities.roundDouble(maxDistanceHorizontal, 1) + ")"); + ", max=" + Utilities.roundDouble(maxDistanceHorizontal, 1) + ")", user.getGoodLocation(previous));
return; return;
} }
if (distanceVertical < -4.0D && user.getVelocityTracker().getVertical() != 0.0D) { if (distanceVertical < -4.0D && user.getVelocityTracker().getVertical() == 0.0D) {
flag(player, event, "moved too far between packets (VT, distance=" flag(player, event, "moved too far between packets (VT, distance="
+ Utilities.roundDouble(Math.abs(distanceVertical), 1) + ", max=4.0)"); + Utilities.roundDouble(Math.abs(distanceVertical), 1) + ", max=4.0)", user.getGoodLocation(previous));
return; return;
} }
} }
private static void flag(final Player player, final PacketEvent event, final String message) { private static void flag(final Player player, final PacketEvent event, final String message, final Location setback) {
event.setCancelled(true); event.setCancelled(true);
// We are currently not in the main server thread, so switch // We are currently not in the main server thread, so switch
AntiCheatReloaded.sendToMainThread(new Runnable() { AntiCheatReloaded.sendToMainThread(() -> {
@Override EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
public void run() { CheckType.BADPACKETS, null);
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player, player.teleport(setback != null ? setback : player.getLocation());
CheckType.BADPACKETS, null);
player.teleport(player.getLocation());
}
}); });
} }
@@ -43,6 +43,11 @@ public final class MorePacketsCheck {
public static final Map<UUID, Double> PACKET_BALANCE = new HashMap<UUID, Double>(); public static final Map<UUID, Double> PACKET_BALANCE = new HashMap<UUID, Double>();
public static void runCheck(final Player player, final PacketEvent event) { public static void runCheck(final Player player, final PacketEvent event) {
if (event.isCancelled()) {
// Do not check if cancelled
return;
}
// Confirm if we should even check for MorePackets // Confirm if we should even check for MorePackets
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
final double tps = AntiCheatReloaded.getPlugin().getTPS(); final double tps = AntiCheatReloaded.getPlugin().getTPS();
@@ -36,13 +36,13 @@ import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
import com.rammelkast.anticheatreloaded.config.providers.Checks; import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
public final class IllegalInteract { public final class IllegalInteractCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult performCheck(final Player player, final Event event) { public static CheckResult runCheck(final Player player, final Event event) {
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
if (event instanceof BlockPlaceEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "place")) { if (event instanceof BlockPlaceEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "place")) {
return checkBlockPlace(player, (BlockPlaceEvent) event); return checkBlockPlace(player, (BlockPlaceEvent) event);
@@ -105,7 +105,7 @@ public final class IllegalInteract {
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
final double distance = player.getGameMode() == GameMode.CREATIVE ? 6.0 final double distance = player.getGameMode() == GameMode.CREATIVE ? 6.0
: player.getLocation().getDirection().getY() > 0.9 ? 6.0 : 5.5; : player.getLocation().getDirection().getY() > 0.9 ? 6.0 : 5.5;
final Block targetBlock = VersionUtil.getTargetBlock(player, ((int) Math.ceil(distance))); final Block targetBlock = VersionLib.getTargetBlock(player, ((int) Math.ceil(distance)));
if (targetBlock == null) { if (targetBlock == null) {
// TODO better check here // TODO better check here
return true; return true;
@@ -32,7 +32,7 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.providers.Checks; import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
public final class NoFallCheck { public final class NoFallCheck {
@@ -40,18 +40,19 @@ public final class NoFallCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult performCheck(final Player player, final double motionY) { public static CheckResult runCheck(final Player player, final double motionY) {
final UUID uuid = player.getUniqueId(); final UUID uuid = player.getUniqueId();
final Backend backend = AntiCheatReloaded.getManager().getBackend(); final Backend backend = AntiCheatReloaded.getManager().getBackend();
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping() if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
&& !backend.isMovingExempt(player) && !backend.justPlaced(player) && !Utilities.isNearWater(player) && !backend.isMovingExempt(player) && !backend.justPlaced(player) && !Utilities.isNearWater(player)
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR") && !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
&& !VersionUtil.isSlowFalling(player) && !VersionLib.isSlowFalling(player)
&& !Utilities && !Utilities
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation()) .isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation())
&& !Utilities.isNearClimbable(player) && !Utilities.isNearClimbable(player)
&& !Utilities.isNearWater(player.getLocation().clone().subtract(0, 1.5, 0))) { && !Utilities.isNearWater(player.getLocation().clone().subtract(0, 1.5, 0))
&& !Utilities.couldBeOnBoat(player, 0.35, false)) {
if (player.getFallDistance() == 0.0) { if (player.getFallDistance() == 0.0) {
if (VIOLATIONS.get(uuid) == null) { if (VIOLATIONS.get(uuid) == null) {
VIOLATIONS.put(uuid, 1); VIOLATIONS.put(uuid, 1);
@@ -20,59 +20,55 @@ package com.rammelkast.anticheatreloaded.event;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract; import com.rammelkast.anticheatreloaded.check.player.IllegalInteractCheck;
public class BlockListener extends EventListener { public final class BlockListener extends EventListener {
@EventHandler(ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST)
public void onBlockPlace(BlockPlaceEvent event) { public void onBlockPlace(final BlockPlaceEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
boolean noHack = true;
if (getCheckManager().willCheck(player, CheckType.FAST_PLACE)) { if (getCheckManager().willCheck(player, CheckType.FAST_PLACE)) {
CheckResult result = getBackend().checkFastPlace(player); final CheckResult result = getBackend().checkFastPlace(player);
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_PLACE, result.getSubCheck()); log(result.getMessage(), player, CheckType.FAST_PLACE, result.getSubCheck());
noHack = false; return;
} }
} }
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) { if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
CheckResult result = IllegalInteract.performCheck(player, event); final CheckResult result = IllegalInteractCheck.runCheck(player, event);
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck()); log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
noHack = false; return;
} }
} }
if (noHack) {
decrease(player); decrease(player);
getBackend().logBlockPlace(player); getBackend().logBlockPlace(player);
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners()); AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
} }
@EventHandler(ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST)
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(final BlockBreakEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
boolean noHack = true;
CheckResult result;
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) { if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
result = IllegalInteract.performCheck(player, event); final CheckResult result = IllegalInteractCheck.runCheck(player, event);
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck()); log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
noHack = false; return;
} }
} }
if (noHack) {
decrease(player); decrease(player);
}
} }
} }
@@ -39,110 +39,138 @@ import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
public class EntityListener extends EventListener { public class EntityListener extends EventListener {
@EventHandler @EventHandler
public void onEntityShootBow(EntityShootBowEvent event) { public void onEntityShootBow(EntityShootBowEvent event) {
if (event.getEntity() instanceof Player) { if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity(); Player player = (Player) event.getEntity();
if (getCheckManager().willCheck(player, CheckType.FAST_BOW)) { if (getCheckManager().willCheck(player, CheckType.FAST_BOW)) {
CheckResult result = getBackend().checkFastBow(player, event.getForce()); CheckResult result = getBackend().checkFastBow(player, event.getForce());
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_BOW, result.getSubCheck()); log(result.getMessage(), player, CheckType.FAST_BOW, result.getSubCheck());
} else { } else {
decrease(player);
}
}
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
@EventHandler
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if (event.getEntity() instanceof Player && event.getRegainReason() == RegainReason.SATIATED) {
Player player = (Player) event.getEntity();
if (getCheckManager().willCheck(player, CheckType.FAST_HEAL)) {
CheckResult result = getBackend().checkFastHeal(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_HEAL, result.getSubCheck());
} else {
decrease(player);
getBackend().logHeal(player);
}
}
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
@EventHandler
public void onFoodLevelChange(FoodLevelChangeEvent event) {
if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
if (player.getFoodLevel() < event.getFoodLevel() && getCheckManager().willCheck(player, CheckType.FAST_EAT)) // Make sure it's them actually gaining a food level
{
CheckResult result = getBackend().checkFastEat(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_EAT, result.getSubCheck());
} else {
decrease(player);
}
}
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
boolean noHack = true;
if (event instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
if (e.getDamager() instanceof Player) {
if (getCheckManager().willCheck((Player)e.getDamager(), CheckType.CRITICALS)) {
CriticalsCheck.doDamageEvent(e, (Player)e.getDamager());
}
if (getCheckManager().willCheckQuick((Player)e.getDamager(), CheckType.AIMBOT)) {
final CheckResult result = AimbotCheck.runCheck((Player)e.getDamager(), e);
if (result.failed()) {
log(result.getMessage(), (Player)e.getDamager(), CheckType.AIMBOT, result.getSubCheck());
}
}
}
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
Player player = (Player) e.getDamager();
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
CheckResult result = KillAuraCheck.checkAngle(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
noHack = false;
}
}
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
noHack = false;
}
}
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
CheckResult result = KillAuraCheck.checkPacketOrder(player, event.getEntity());
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
noHack = false;
}
}
if (noHack) {
decrease(player); decrease(player);
} }
} }
} }
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners()); AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
} }
@EventHandler
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if (event.getEntity() instanceof Player && event.getRegainReason() == RegainReason.SATIATED) {
Player player = (Player) event.getEntity();
if (getCheckManager().willCheck(player, CheckType.FAST_HEAL)) {
CheckResult result = getBackend().checkFastHeal(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_HEAL, result.getSubCheck());
} else {
decrease(player);
getBackend().logHeal(player);
}
}
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
@EventHandler
public void onFoodLevelChange(FoodLevelChangeEvent event) {
if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
if (player.getFoodLevel() < event.getFoodLevel()
&& getCheckManager().willCheck(player, CheckType.FAST_EAT)) {
CheckResult result = getBackend().checkFastEat(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_EAT, result.getSubCheck());
} else {
decrease(player);
}
}
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(final EntityDamageEvent event) {
if (event instanceof EntityDamageByEntityEvent) {
final EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
if (e.getDamager() instanceof Player) {
if (getCheckManager().willCheck((Player) e.getDamager(), CheckType.CRITICALS)) {
CriticalsCheck.doDamageEvent(e, (Player) e.getDamager());
}
if (getCheckManager().willCheckQuick((Player) e.getDamager(), CheckType.AIMBOT)) {
final CheckResult result = AimbotCheck.runCheck((Player) e.getDamager(), e);
if (result.failed()) {
log(result.getMessage(), (Player) e.getDamager(), CheckType.AIMBOT, result.getSubCheck());
}
}
}
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
final Player player = (Player) e.getDamager();
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
final CheckResult result = KillAuraCheck.checkAngle(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
return;
}
}
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
final CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
return;
}
}
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
final CheckResult result = KillAuraCheck.checkPacketOrder(player, event.getEntity());
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
return;
}
}
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
final CheckResult result = KillAuraCheck.checkRepeatedAim(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
return;
}
}
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
final CheckResult result = KillAuraCheck.checkVariance(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
return;
}
}
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
final CheckResult result = KillAuraCheck.checkThroughWalls(player, event.getEntity());
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
return;
}
}
decrease(player);
}
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
} }
@@ -66,15 +66,15 @@ public class EventListener implements Listener {
if (message == null || message.equals("")) { if (message == null || message.equals("")) {
if (debugMode) { if (debugMode) {
message = prefix + player.getName() + " failed " message = prefix + player.getName() + " failed "
+ type.getName(); + type.getName() + (subcheck != null ? (" (" + subcheck + ")") : "");
} else { } else {
message = prefix + player.getName() + " failed " message = prefix + player.getName() + " failed "
+ type.getName() + ChatColor.GOLD + " (x" + vlForType + ")"; + type.getName() + (subcheck != null ? (" (" + subcheck + ")") : "") + ChatColor.GOLD + " (x" + vlForType + ")";
} }
} else { } else {
if (debugMode) { if (debugMode) {
message = prefix + player.getName() + " failed " message = prefix + player.getName() + " failed "
+ type.getName() + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message + type.getName() + (subcheck != null ? (" (" + subcheck + ")") : "") + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms" + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS()); + ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
} else { } else {
@@ -0,0 +1,93 @@
/*
* AntiCheatReloaded for Bukkit and Spigot.
* Copyright (c) 2012-2015 AntiCheat Team
* Copyright (c) 2016-2022 Rammelkast
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.rammelkast.anticheatreloaded.event;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.injector.server.TemporaryPlayer;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck;
import com.rammelkast.anticheatreloaded.check.packet.BadPacketsCheck;
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
public final class PacketListener extends PacketAdapter {
public PacketListener(final Plugin plugin) {
super(plugin, ListenerPriority.LOWEST, PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK,
PacketType.Play.Client.LOOK, PacketType.Play.Server.POSITION, PacketType.Play.Client.BLOCK_DIG);
}
@Override
public void onPacketReceiving(final PacketEvent event) {
final Player player = event.getPlayer();
if (player == null || !player.isOnline()) {
return;
}
// Check if we have an actual player object
if (player instanceof TemporaryPlayer) {
return;
}
final PacketType type = event.getPacketType();
final PacketContainer packet = event.getPacket();
if (type == PacketType.Play.Client.POSITION || type == PacketType.Play.Client.POSITION_LOOK) {
// Run MorePackets check
MorePacketsCheck.runCheck(player, event);
// Run BadPackets check
BadPacketsCheck.runCheck(player, event);
return;
}
if (event.getPacketType() == PacketType.Play.Client.BLOCK_DIG) {
if (packet.getPlayerDigTypes().read(0) == PlayerDigType.RELEASE_USE_ITEM) {
// Run NoSlow check
NoSlowCheck.runCheck(event.getPlayer(), event);
}
return;
}
}
@Override
public void onPacketSending(final PacketEvent event) {
final Player player = event.getPlayer();
if (player == null || !player.isOnline()) {
return;
}
// Check if we have an actual player object
if (player instanceof TemporaryPlayer) {
return;
}
final PacketType type = event.getPacketType();
if (type == PacketType.Play.Server.POSITION) {
// Compensate for teleport
MorePacketsCheck.compensate(player);
}
}
}
@@ -71,14 +71,14 @@ import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck; import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
import com.rammelkast.anticheatreloaded.check.movement.StrafeCheck; import com.rammelkast.anticheatreloaded.check.movement.StrafeCheck;
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck; import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract; import com.rammelkast.anticheatreloaded.check.player.IllegalInteractCheck;
import com.rammelkast.anticheatreloaded.check.player.NoFallCheck; import com.rammelkast.anticheatreloaded.check.player.NoFallCheck;
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager; import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
import com.rammelkast.anticheatreloaded.util.Distance; import com.rammelkast.anticheatreloaded.util.Distance;
import com.rammelkast.anticheatreloaded.util.Permission; import com.rammelkast.anticheatreloaded.util.Permission;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
public final class PlayerListener extends EventListener { public final class PlayerListener extends EventListener {
@@ -313,7 +313,7 @@ public final class PlayerListener extends EventListener {
if (block != null if (block != null
&& (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)) { && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) { if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
final CheckResult result = IllegalInteract.performCheck(player, event); final CheckResult result = IllegalInteractCheck.runCheck(player, event);
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck()); log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
@@ -390,7 +390,7 @@ public final class PlayerListener extends EventListener {
} }
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerMove(final PlayerMoveEvent event) { public void onPlayerMove(final PlayerMoveEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (getCheckManager().checkInWorld(player) && !getCheckManager().isOpExempt(player)) { if (getCheckManager().checkInWorld(player) && !getCheckManager().isOpExempt(player)) {
@@ -404,7 +404,7 @@ public final class PlayerListener extends EventListener {
user.setTo(to.getX(), to.getY(), to.getZ()); user.setTo(to.getX(), to.getY(), to.getZ());
user.getMovementManager().handle(player, from, to, distance); user.getMovementManager().handle(player, from, to, distance);
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) { if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionLib.isFlying(player)) {
final CheckResult result = FlightCheck.runCheck(player, distance); final CheckResult result = FlightCheck.runCheck(player, distance);
if (result.failed()) { if (result.failed()) {
if (!silentMode()) { if (!silentMode()) {
@@ -452,7 +452,7 @@ public final class PlayerListener extends EventListener {
&& getCheckManager().willCheck(player, CheckType.FLIGHT) && getCheckManager().willCheck(player, CheckType.FLIGHT)
&& !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
&& event.getFrom().getY() > event.getTo().getY()) { && event.getFrom().getY() > event.getTo().getY()) {
final CheckResult result = NoFallCheck.performCheck(player, y); final CheckResult result = NoFallCheck.runCheck(player, y);
if (result.failed()) { if (result.failed()) {
if (!silentMode()) { if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone())); event.setTo(user.getGoodLocation(from.clone()));
@@ -464,43 +464,66 @@ public final class PlayerListener extends EventListener {
if (event.getTo() != event.getFrom()) { if (event.getTo() != event.getFrom()) {
final double x = distance.getXDifference(); final double x = distance.getXDifference();
final double z = distance.getZDifference(); final double z = distance.getZDifference();
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) if (getCheckManager().willCheckQuick(player, CheckType.SPEED)) {
&& getCheckManager().willCheck(player, CheckType.FLIGHT)) { final CheckResult result = SpeedCheck.checkPredict(player, event.getTo());
if (event.getFrom().getY() < event.getTo().getY()) {
final CheckResult result = SpeedCheck.checkVerticalSpeed(player, distance);
if (result.failed()) {
if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone()));
}
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
}
}
final CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
if (result.failed()) { if (result.failed()) {
if (!silentMode()) { if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone())); event.setTo(user.getGoodLocation(from.clone()));
} }
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck()); log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
return;
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && event.getFrom().getY() < event.getTo().getY()) {
final CheckResult result = SpeedCheck.checkVerticalSpeed(player, distance);
if (result.failed()) {
if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone()));
}
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
return;
}
}
if (getCheckManager().willCheckQuick(player, CheckType.SPEED)) {
final CheckResult result = SpeedCheck.checkXZSpeed(player, event.getTo());
if (result.failed()) {
if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone()));
}
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
return;
}
}
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) { if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
final CheckResult result = WaterWalkCheck.runCheck(player, x, y, z); final CheckResult result = WaterWalkCheck.runCheck(player, x, y, z);
if (result.failed()) { if (result.failed()) {
if (!silentMode()) { if (!silentMode()) {
player.teleport(player.getLocation().clone().subtract(0, 0.42, 0)); player.teleport(player.getLocation().clone().subtract(0, 0.42f, 0));
} }
log(result.getMessage(), player, CheckType.WATER_WALK, result.getSubCheck()); log(result.getMessage(), player, CheckType.WATER_WALK, result.getSubCheck());
return;
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) { if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
final CheckResult result = getBackend().checkSpider(player, y); final CheckResult result = getBackend().checkSpider(player, y);
if (result.failed()) { if (result.failed()) {
if (!silentMode()) { if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone())); event.setTo(user.getGoodLocation(from.clone()));
} }
log(result.getMessage(), player, CheckType.SPIDER, result.getSubCheck()); log(result.getMessage(), player, CheckType.SPIDER, result.getSubCheck());
return;
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) { if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
// Does not use y value created before because that value is absolute // Does not use y value created before because that value is absolute
final CheckResult result = FastLadderCheck.runCheck(player, final CheckResult result = FastLadderCheck.runCheck(player,
@@ -509,19 +532,25 @@ public final class PlayerListener extends EventListener {
if (!silentMode()) { if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone())); event.setTo(user.getGoodLocation(from.clone()));
} }
log(result.getMessage(), player, CheckType.FASTLADDER, result.getSubCheck()); log(result.getMessage(), player, CheckType.FASTLADDER, result.getSubCheck());
return;
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.STRAFE)) { if (getCheckManager().willCheckQuick(player, CheckType.STRAFE)) {
final CheckResult result = StrafeCheck.runCheck(player, x, z, event.getFrom(), event.getTo()); final CheckResult result = StrafeCheck.runCheck(player, x, z, event.getFrom(), event.getTo());
if (result.failed()) { if (result.failed()) {
if (!silentMode()) { if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone())); event.setTo(user.getGoodLocation(from.clone()));
} }
log(result.getMessage(), player, CheckType.STRAFE, result.getSubCheck()); log(result.getMessage(), player, CheckType.STRAFE, result.getSubCheck());
return;
} }
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.VELOCITY)) { if (getCheckManager().willCheckQuick(player, CheckType.VELOCITY)) {
final CheckResult result = VelocityCheck.runCheck(player, distance); final CheckResult result = VelocityCheck.runCheck(player, distance);
if (result.failed()) { if (result.failed()) {
@@ -33,7 +33,7 @@ import org.geysermc.floodgate.api.FloodgateApi;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.Configuration; import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionLib;
/** /**
* The manager that AntiCheatReloaded will check with to see if it should watch * The manager that AntiCheatReloaded will check with to see if it should watch
@@ -191,7 +191,7 @@ public final class CheckManager {
&& !isExempt(player, type) && !isExempt(player, type)
&& !type.checkPermission(player) && !type.checkPermission(player)
&& !isOpExempt(player); && !isOpExempt(player);
if ((type == CheckType.FLIGHT || type == CheckType.SPEED) && VersionUtil.isFlying(player)) { if ((type == CheckType.FLIGHT || type == CheckType.SPEED) && VersionLib.isFlying(player)) {
return false; return false;
} }
return check; return check;
@@ -0,0 +1,66 @@
/*
* AntiCheatReloaded for Bukkit and Spigot.
* Copyright (c) 2012-2015 AntiCheat Team
* Copyright (c) 2016-2022 Rammelkast
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.rammelkast.anticheatreloaded.util;
import org.bukkit.Material;
import org.bukkit.block.Block;
/**
* Friction data library to prevent using Reflection or NMS
*/
public enum Friction {
DEFAULT(0.6f),
ICE(0.98f),
BLUE_ICE(0.989f),
PACKED_ICE(0.98f),
SLIME_BLOCK(0.8f),
;
private final float factor;
Friction(final float factor) {
this.factor = factor;
}
/**
* Gets the friction factor
*
* @return the factor
*/
public float getFactor() {
return this.factor;
}
/**
* Gets the friction factor for the given block
*
* @param block The block
* @return the friction factor
*/
public static float getFactor(final Block block) {
final Material type = block.getType();
try {
return valueOf(type.name()).getFactor();
} catch (final Exception exception) {
return DEFAULT.getFactor();
}
}
}
@@ -73,6 +73,8 @@ public final class MovementManager {
public Distance lastDistance = new Distance(); public Distance lastDistance = new Distance();
// Movement acceleration // Movement acceleration
public double acceleration; public double acceleration;
// Last movement acceleration
public double lastAcceleration;
// Is the block above solid // Is the block above solid
public boolean topSolid; public boolean topSolid;
// Is the block below solid // Is the block below solid
@@ -81,6 +83,8 @@ public final class MovementManager {
public boolean halfMovement; public boolean halfMovement;
// If the player is on the ground (determined clientside!) // If the player is on the ground (determined clientside!)
public boolean onGround; public boolean onGround;
// If the player was on the ground (determined clientside!)
public boolean wasOnGround;
// Ticks counter for last halfMovement // Ticks counter for last halfMovement
public int halfMovementHistoryCounter = 0; public int halfMovementHistoryCounter = 0;
// Time of last teleport // Time of last teleport
@@ -107,12 +111,16 @@ public final class MovementManager {
public long lastUpdate; public long lastUpdate;
// Last location // Last location
public Location lastLocation; public Location lastLocation;
/**
* Used by prediction speed check
*/
public float friction;
public double adjusted;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void handle(final Player player, final Location from, final Location to, final Distance distance) { public void handle(final Player player, final Location from, final Location to, final Distance distance) {
// TODO as of now, we "trust" the client to send the right thing this.wasOnGround = this.onGround;
// This is checked for spoofing by "GroundFlight"
// Also seems to make NoFall cheats flag for speed lmao
this.onGround = player.isOnGround(); this.onGround = player.isOnGround();
this.lastLocation = from; this.lastLocation = from;
@@ -139,7 +147,7 @@ public final class MovementManager {
// Handle 1.9+ potion effects // Handle 1.9+ potion effects
if (MinecraftVersion.atOrAbove(MinecraftVersion.COMBAT_UPDATE)) { if (MinecraftVersion.atOrAbove(MinecraftVersion.COMBAT_UPDATE)) {
for (PotionEffect effect : player.getActivePotionEffects()) { for (PotionEffect effect : player.getActivePotionEffects()) {
if (!VersionUtil.isLevitationEffect(effect)) { if (!VersionLib.isLevitationEffect(effect)) {
continue; continue;
} }
AntiCheatReloaded.getManager().getBackend().logLevitating(player, 1); AntiCheatReloaded.getManager().getBackend().logLevitating(player, 1);
@@ -188,7 +196,7 @@ public final class MovementManager {
} }
} }
if (VersionUtil.isGliding(player)) { if (VersionLib.isGliding(player)) {
this.elytraEffectTicks = 30; this.elytraEffectTicks = 30;
} else { } else {
if (this.elytraEffectTicks > 0) { if (this.elytraEffectTicks > 0) {
@@ -218,7 +226,7 @@ public final class MovementManager {
} }
} }
if (VersionUtil.isRiptiding(player)) { if (VersionLib.isRiptiding(player)) {
this.riptideTicks = 30; this.riptideTicks = 30;
} else { } else {
if (this.riptideTicks > 0) { if (this.riptideTicks > 0) {
@@ -235,6 +243,7 @@ public final class MovementManager {
+ this.lastDistance.getZDifference() * this.lastDistance.getZDifference()); + this.lastDistance.getZDifference() * this.lastDistance.getZDifference());
final double currentDistanceSq = Math.sqrt(distance.getXDifference() * distance.getXDifference() final double currentDistanceSq = Math.sqrt(distance.getXDifference() * distance.getXDifference()
+ distance.getZDifference() * distance.getZDifference()); + distance.getZDifference() * distance.getZDifference());
this.lastAcceleration = this.acceleration;
this.acceleration = currentDistanceSq - lastDistanceSq; this.acceleration = currentDistanceSq - lastDistanceSq;
this.lastMotionY = this.motionY; this.lastMotionY = this.motionY;
@@ -245,7 +254,7 @@ public final class MovementManager {
final Location bottom = to.clone().add(0, -1, 0); final Location bottom = to.clone().add(0, -1, 0);
this.bottomSolid = bottom.getBlock().getType().isSolid(); this.bottomSolid = bottom.getBlock().getType().isSolid();
if ((this.motionY > 0.42f && this.motionY <= 0.5625f) if ((this.motionY >= 0.42f && this.motionY <= 0.5625f)
&& (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) { && (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
this.halfMovement = true; this.halfMovement = true;
this.halfMovementHistoryCounter = 30; this.halfMovementHistoryCounter = 30;
@@ -263,4 +272,5 @@ public final class MovementManager {
// Update "good location" // Update "good location"
user.setGoodLocation(from); user.setGoodLocation(from);
} }
} }
@@ -1,100 +0,0 @@
/*
* AntiCheatReloaded for Bukkit and Spigot.
* Copyright (c) 2012-2015 AntiCheat Team
* Copyright (c) 2016-2022 Rammelkast
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.rammelkast.anticheatreloaded.util;
import org.bukkit.entity.Player;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.injector.server.TemporaryPlayer;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck;
import com.rammelkast.anticheatreloaded.check.packet.BadPacketsCheck;
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
public final class PacketListener {
public static void load(final ProtocolManager manager) {
// Used for MorePackets and BadPackets
manager.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK,
PacketType.Play.Server.POSITION }) {
@Override
public void onPacketReceiving(final PacketEvent event) {
final Player player = event.getPlayer();
if (player == null || !player.isOnline()) {
return;
}
// Run MorePackets check
MorePacketsCheck.runCheck(player, event);
if (!event.isCancelled()) {
// Run BadPackets check
BadPacketsCheck.runCheck(player, event);
}
}
@Override
public void onPacketSending(final PacketEvent event) {
final Player player = event.getPlayer();
// Check if we have an actual player object
if (player instanceof TemporaryPlayer) {
return;
}
// Compensate for teleport
MorePacketsCheck.compensate(player);
}
});
// Used for accurate ping
manager.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
new PacketType[] { PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Server.KEEP_ALIVE }) {
@Override
public void onPacketSending(final PacketEvent event) {
final User user = AntiCheatReloaded.getManager().getUserManager()
.getUser(event.getPlayer().getUniqueId());
user.onServerPing();
}
@Override
public void onPacketReceiving(final PacketEvent event) {
final User user = AntiCheatReloaded.getManager().getUserManager()
.getUser(event.getPlayer().getUniqueId());
user.onClientPong();
}
});
// Used for NoSlow
manager.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(),
ListenerPriority.LOWEST, new PacketType[] { PacketType.Play.Client.BLOCK_DIG }) {
@Override
public void onPacketReceiving(final PacketEvent event) {
if (event.getPacket().getPlayerDigTypes().read(0) == PlayerDigType.RELEASE_USE_ITEM) {
NoSlowCheck.runCheck(event.getPlayer(), event);
}
}
});
}
}
@@ -50,7 +50,6 @@ public final class User {
private boolean isWaitingOnLevelSync; private boolean isWaitingOnLevelSync;
private Timestamp levelSyncTimestamp; private Timestamp levelSyncTimestamp;
private long lastServerPing, lastClientPong;
private int ping = -1; private int ping = -1;
private int lastPing = -1; private int lastPing = -1;
@@ -68,7 +67,7 @@ public final class User {
this.uuid = uuid; this.uuid = uuid;
this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : ""; this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : "";
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1; this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
this.ping = getPlayer() != null && getPlayer().isOnline() ? VersionUtil.getPlayerPing(getPlayer()) : -1; this.ping = getPlayer() != null && getPlayer().isOnline() ? VersionLib.getPlayerPing(getPlayer()) : -1;
this.movementManager = new MovementManager(); this.movementManager = new MovementManager();
this.velocityTracker = new VelocityTracker(this.config.getMagic().VELOCITY_TIME()); this.velocityTracker = new VelocityTracker(this.config.getMagic().VELOCITY_TIME());
@@ -402,20 +401,10 @@ public final class User {
return levelSyncTimestamp; return levelSyncTimestamp;
} }
public void onServerPing() {
this.lastServerPing = System.currentTimeMillis();
}
public void onClientPong() {
this.lastClientPong = System.currentTimeMillis();
this.lastPing = this.ping;
this.ping = (int) (this.lastClientPong - this.lastServerPing);
}
public int getPing() { public int getPing() {
final int ping = this.ping; final int ping = this.ping;
if (ping < 0) { if (ping < 0) {
return VersionUtil.getPlayerPing(getPlayer()); return VersionLib.getPlayerPing(getPlayer());
} }
return ping; return ping;
} }
@@ -22,6 +22,7 @@ package com.rammelkast.anticheatreloaded.util;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -31,6 +32,8 @@ import java.util.regex.Pattern;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@@ -80,8 +83,8 @@ public final class Utilities {
* @return true if the player should be unable to stand here * @return true if the player should be unable to stand here
*/ */
public static boolean cantStandAtExp(final Location location) { public static boolean cantStandAtExp(final Location location) {
return cantStandAt(new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, return cantStandAt(new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getZ())
location.getZ()).getBlock()); .getBlock());
} }
/** /**
@@ -134,7 +137,7 @@ public final class Utilities {
final Material type = block.getType(); final Material type = block.getType();
return type.equals(XMaterial.SLIME_BLOCK.parseMaterial()); return type.equals(XMaterial.SLIME_BLOCK.parseMaterial());
} }
public static boolean couldBeOnBoat(final Player player) { public static boolean couldBeOnBoat(final Player player) {
return couldBeOnBoat(player, 0.35, false); return couldBeOnBoat(player, 0.35, false);
} }
@@ -159,12 +162,11 @@ public final class Utilities {
* @return true if the player could be standing on ice * @return true if the player could be standing on ice
*/ */
public static boolean couldBeOnIce(final Location location) { public static boolean couldBeOnIce(final Location location) {
return isNearIce(new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, return isNearIce(new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getZ()))
location.getZ())) || isNearIce(
|| isNearIce(new Location(location.getWorld(), location.getX(), location.getY() - 0.26D, new Location(location.getWorld(), location.getX(), location.getY() - 0.26D, location.getZ()))
location.getZ())) || isNearIce(
|| isNearIce(new Location(location.getWorld(), location.getX(), location.getY() - 0.51D, new Location(location.getWorld(), location.getX(), location.getY() - 0.51D, location.getZ()));
location.getZ()));
} }
public static boolean isNearIce(final Location location) { public static boolean isNearIce(final Location location) {
@@ -188,8 +190,8 @@ public final class Utilities {
public static boolean couldBeOnHalfblock(final Location location) { public static boolean couldBeOnHalfblock(final Location location) {
return isNearHalfblock( return isNearHalfblock(
new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getZ())) new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getZ()))
|| isNearHalfblock(new Location(location.getWorld(), location.getX(), location.getY() - 0.51D, || isNearHalfblock(
location.getZ())); new Location(location.getWorld(), location.getX(), location.getY() - 0.51D, location.getZ()));
} }
public static boolean isNearHalfblock(final Location location) { public static boolean isNearHalfblock(final Location location) {
@@ -223,16 +225,15 @@ public final class Utilities {
* @return true if the player could be standing on slime * @return true if the player could be standing on slime
*/ */
public static boolean couldBeOnSlime(final Location location) { public static boolean couldBeOnSlime(final Location location) {
return isNearSlime(new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, return isNearSlime(new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getZ()))
location.getZ())) || isNearSlime(
|| isNearSlime(new Location(location.getWorld(), location.getX(), location.getY() - 0.51D, new Location(location.getWorld(), location.getX(), location.getY() - 0.51D, location.getZ()));
location.getZ()));
} }
public static boolean isNearSlime(final Location location) { public static boolean isNearSlime(final Location location) {
return isCollisionPoint(location, material -> material == XMaterial.SLIME_BLOCK.parseMaterial()); return isCollisionPoint(location, material -> material == XMaterial.SLIME_BLOCK.parseMaterial());
} }
/** /**
* Determine whether a player could be standing on soil * Determine whether a player could be standing on soil
* *
@@ -240,14 +241,14 @@ public final class Utilities {
* @return true if the player could be standing on soil * @return true if the player could be standing on soil
*/ */
public static boolean couldBeOnSoil(final Location location) { public static boolean couldBeOnSoil(final Location location) {
return isNearSoil(new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, return isNearSoil(new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getZ()))
location.getZ())) || isNearSoil(
|| isNearSoil(new Location(location.getWorld(), location.getX(), location.getY() - 0.51D, new Location(location.getWorld(), location.getX(), location.getY() - 0.51D, location.getZ()));
location.getZ()));
} }
public static boolean isNearSoil(final Location location) { public static boolean isNearSoil(final Location location) {
return isCollisionPoint(location, material -> material == XMaterial.SOUL_SOIL.parseMaterial() || material == XMaterial.SOUL_SAND.parseMaterial()); return isCollisionPoint(location, material -> material == XMaterial.SOUL_SOIL.parseMaterial()
|| material == XMaterial.SOUL_SAND.parseMaterial());
} }
/** /**
@@ -374,7 +375,7 @@ public final class Utilities {
Material type = block.getType(); Material type = block.getType();
return type.name().endsWith("WALL") || type.name().endsWith("FENCE") || type.name().endsWith("FENCE_GATE"); return type.name().endsWith("WALL") || type.name().endsWith("FENCE") || type.name().endsWith("FENCE_GATE");
} }
public static boolean isNearWall(final Location location) { public static boolean isNearWall(final Location location) {
return isWall(location.getBlock()) || isWall(location.getBlock().getRelative(BlockFace.NORTH)) return isWall(location.getBlock()) || isWall(location.getBlock().getRelative(BlockFace.NORTH))
|| isWall(location.getBlock().getRelative(BlockFace.SOUTH)) || isWall(location.getBlock().getRelative(BlockFace.SOUTH))
@@ -400,7 +401,7 @@ public final class Utilities {
|| block.getRelative(BlockFace.EAST).getType() == XMaterial.LILY_PAD.parseMaterial() || block.getRelative(BlockFace.EAST).getType() == XMaterial.LILY_PAD.parseMaterial()
|| block.getRelative(BlockFace.WEST).getType() == XMaterial.LILY_PAD.parseMaterial(); || block.getRelative(BlockFace.WEST).getType() == XMaterial.LILY_PAD.parseMaterial();
} }
/** /**
* Determine whether a player is standing on a carpet * Determine whether a player is standing on a carpet
* *
@@ -748,9 +749,10 @@ public final class Utilities {
int rounded = (int) value; int rounded = (int) value;
return value < rounded ? rounded - 1 : rounded; return value < rounded ? rounded - 1 : rounded;
} }
/** /**
* Computes the difference between two angles * Computes the difference between two angles
*
* @param a Angle A * @param a Angle A
* @param b Angle B * @param b Angle B
* @return the difference between two angles * @return the difference between two angles
@@ -759,10 +761,12 @@ public final class Utilities {
float diff = Math.abs(a - b); float diff = Math.abs(a - b);
final float altDiff = b + 360 - a; final float altDiff = b + 360 - a;
final float altAltDiff = a + 360 - b; final float altAltDiff = a + 360 - b;
if (altDiff < diff) diff = altDiff; if (altDiff < diff)
if (altAltDiff < diff) diff = altAltDiff; diff = altDiff;
return diff; if (altAltDiff < diff)
} diff = altAltDiff;
return diff;
}
/** /**
* Calculates the greatest common divider * Calculates the greatest common divider
@@ -789,6 +793,49 @@ public final class Utilities {
} }
return materials.stream().anyMatch(predicate); return materials.stream().anyMatch(predicate);
} }
/**
* @author Elevated
* @param data - The set of data you want to find the variance from
* @return - The variance of the numbers.
*
* @See - https://en.wikipedia.org/wiki/Variance
*/
public static double getVariance(final Collection<? extends Number> data) {
int count = 0;
double sum = 0.0;
double variance = 0.0;
double average;
// Increase the sum and the count to find the average and the standard deviation
for (final Number number : data) {
sum += number.doubleValue();
++count;
}
average = sum / count;
// Run the standard deviation formula
for (final Number number : data) {
variance += Math.pow(number.doubleValue() - average, 2.0);
}
return variance;
}
/**
* Gets the allowed player movement speed through the "GENERIC_MOVEMENT_SPEED"
* attribute
*
* @return the allowed player movement speed
*/
public static double getMovementSpeed(final Player player) {
final AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
return attribute.getValue();
}
static { static {
MinecraftVersion currentVersion = MinecraftVersion.getCurrentVersion(); MinecraftVersion currentVersion = MinecraftVersion.getCurrentVersion();
@@ -941,7 +988,7 @@ public final class Utilities {
CLIMBABLE.add(XMaterial.HONEY_BLOCK.parseMaterial()); CLIMBABLE.add(XMaterial.HONEY_BLOCK.parseMaterial());
} }
// End 1.15 objects // End 1.15 objects
// Start 1.16 objects // Start 1.16 objects
if (currentVersion.isAtLeast(MinecraftVersion.NETHER_UPDATE)) { if (currentVersion.isAtLeast(MinecraftVersion.NETHER_UPDATE)) {
CLIMBABLE.add(XMaterial.TWISTING_VINES.parseMaterial()); CLIMBABLE.add(XMaterial.TWISTING_VINES.parseMaterial());
@@ -34,7 +34,7 @@ import org.bukkit.potion.PotionEffectType;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
public class VersionUtil { public class VersionLib {
public static final MinecraftVersion CURRENT_VERSION; public static final MinecraftVersion CURRENT_VERSION;
private static final List<String> SUPPORTED_VERSIONS; private static final List<String> SUPPORTED_VERSIONS;
+40 -3
View File
@@ -52,6 +52,11 @@ elytrafly:
# Speed check settings # Speed check settings
# Checks if a player moves too fast # Checks if a player moves too fast
speed: speed:
# Checks movement speed through prediction
# Debugs as 'moved unexpectedly'
predict:
# Should this part of the check be enabled?
enabled: true
# Checks movement speed in the air # Checks movement speed in the air
# Debugs as 'moved too fast in air' # Debugs as 'moved too fast in air'
airSpeed: airSpeed:
@@ -157,9 +162,9 @@ killaura:
# Maximum base reach distances # Maximum base reach distances
baseMaxValue: baseMaxValue:
# Maximum base reach value # Maximum base reach value
normal: 3.5 normal: 3.55
# Maximum base reach value when a player has velocity # Maximum base reach value when a player has velocity
velocitized: 4.0 velocitized: 4.05
# Settings for lag compensation # Settings for lag compensation
lagCompensation: lagCompensation:
# Basic extra allowed reach when a player is lagging # Basic extra allowed reach when a player is lagging
@@ -188,6 +193,31 @@ killaura:
minElapsedTime: 5 minElapsedTime: 5
# Amount of suspicious combat packet situations before flagging # Amount of suspicious combat packet situations before flagging
vlBeforeFlag: 3 vlBeforeFlag: 3
# Checks player pitch behaviour during combat
# Debugs as 'had suspicious aim behaviour'
variance:
# Should this part of the check be enabled?
enabled: true
# How many samples should be taken (increase in case of false positives)
samples: 8
# Checks player pitch and yaw behaviour during combat
# Debugs as 'repeated aim pattern'
repeatedAim:
# Should this part of the check be enabled?
enabled: true
# Checks if the player is hitting through objects
# Debugs as 'hit through object'
throughWalls:
# Should this part of the check be enabled?
enabled: true
# Minimum server TPS needed for the packet order subcheck to be active
minimumTps: 17.5
# Should this check be disabled for lagging players? (this can be spoofed!)
disableForLagging: true
# Amount to expand hitbox by
expand: 0.3
# Amount of illegal hits before flagging
vlBeforeFlag: 4
# Aimbot check settings # Aimbot check settings
# Checks if the player is sending aimbot-like movements # Checks if the player is sending aimbot-like movements
aimbot: aimbot:
@@ -196,7 +226,7 @@ aimbot:
# Maximum pitch acceleration for check to consider aim illegal # Maximum pitch acceleration for check to consider aim illegal
minAcceleration: 5.5 minAcceleration: 5.5
# Maximum mod value for check to consider aim illegal # Maximum mod value for check to consider aim illegal
maxMod: 0.001 maxMod: 8.0E-4
# 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:
@@ -362,6 +392,13 @@ fastprojectile:
projectilesToWait: 10 projectilesToWait: 10
# The minimum time in milliseconds it should have taken for the player fire 'projectilesToWait' projectiles # The minimum time in milliseconds it should have taken for the player fire 'projectilesToWait' projectiles
minimumTime: 1500 minimumTime: 1500
# FastBreak check settings
# Checks if the player breaks too many blocks in too little time
fastbreak:
# Should this check be enabled?
enabled: true
# Minimum server TPS needed for FastBreak to be active
minimumTps: 15.0
# ItemSpam check settings # ItemSpam check settings
# Checks if the player drops items too fast # Checks if the player drops items too fast
itemspam: itemspam: