mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6a39e352a | ||
|
|
700c0145f3 | ||
|
|
c74fc92da9 |
No files matched your search
@@ -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.9.1</version>
|
<version>1.9.2</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>
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ public class Backend {
|
|||||||
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
||||||
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);
|
||||||
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ public enum CheckType {
|
|||||||
CHAT_UNICODE(Permission.CHECK_UNICODE, "ChatUnicode"),
|
CHAT_UNICODE(Permission.CHECK_UNICODE, "ChatUnicode"),
|
||||||
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT, "IllegalInteract"),
|
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT, "IllegalInteract"),
|
||||||
FASTLADDER(Permission.CHECK_FASTLADDER, "FastLadder"),
|
FASTLADDER(Permission.CHECK_FASTLADDER, "FastLadder"),
|
||||||
AIMBOT(Permission.CHECK_AIMBOT, "Aimbot");
|
AIMBOT(Permission.CHECK_AIMBOT, "Aimbot"),
|
||||||
|
STRAFE(Permission.CHECK_STRAFE, "Strafe");
|
||||||
|
|
||||||
private final Permission permission;
|
private final Permission permission;
|
||||||
private final String displayName;
|
private final String displayName;
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ import org.bukkit.util.Vector;
|
|||||||
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.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.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
@@ -40,6 +42,8 @@ public 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
|
||||||
|
public static final Map<UUID, Integer> PACKETORDER_FLAGS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult checkReach(Player player, Entity target) {
|
public static CheckResult checkReach(Player player, Entity target) {
|
||||||
@@ -118,6 +122,39 @@ public class KillAuraCheck {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkPacketOrder(Player player, Entity entity) {
|
||||||
|
UUID uuid = player.getUniqueId();
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "packetOrder"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
if (user.isLagging() || (System.currentTimeMillis() - movementManager.lastTeleport) <= 100
|
||||||
|
|| AntiCheatReloaded.getPlugin().getTPS() < checksConfig.getDouble(CheckType.KILLAURA, "packetOrder", "minimumTps"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
long elapsed = System.currentTimeMillis() - movementManager.lastUpdate;
|
||||||
|
if (elapsed < checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "minElapsedTime")) {
|
||||||
|
if (!PACKETORDER_FLAGS.containsKey(uuid)) {
|
||||||
|
PACKETORDER_FLAGS.put(uuid, 1);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int flags = PACKETORDER_FLAGS.get(uuid);
|
||||||
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "vlBeforeFlag");
|
||||||
|
if (flags >= vlBeforeFlag) {
|
||||||
|
PACKETORDER_FLAGS.remove(uuid);
|
||||||
|
return new CheckResult(Result.FAILED, "suspicious packet order (elapsed=" + elapsed + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKETORDER_FLAGS.put(uuid, flags + 1);
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
public static double calculateYawDifference(Location from, Location to) {
|
public static double calculateYawDifference(Location from, Location to) {
|
||||||
Location clonedFrom = from.clone();
|
Location clonedFrom = from.clone();
|
||||||
Vector startVector = clonedFrom.toVector();
|
Vector startVector = clonedFrom.toVector();
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
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.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
public class ElytraCheck {
|
public class ElytraCheck {
|
||||||
@@ -38,10 +39,9 @@ public class ElytraCheck {
|
|||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
// No elytra in server version
|
// No elytra in server version or not relevant
|
||||||
if (VersionUtil.isBountifulUpdate()) {
|
if (VersionUtil.isBountifulUpdate() || Utilities.isNearWater(player))
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
|
||||||
|
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
|
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ public class FlightCheck {
|
|||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement
|
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement || Utilities.isNearClimbable(player))
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.UP)))
|
|
||||||
return PASS;
|
return PASS;
|
||||||
|
|
||||||
int minAirTicks = 13;
|
int minAirTicks = 13;
|
||||||
@@ -78,7 +75,7 @@ public class FlightCheck {
|
|||||||
|
|
||||||
// Start AirFlight
|
// Start AirFlight
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
||||||
&& !backend.justVelocity(player)) {
|
&& !backend.justVelocity(player) && movementManager.elytraEffectTicks <= 25) {
|
||||||
// Config default base is 1200ms
|
// Config default base is 1200ms
|
||||||
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
||||||
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
@@ -104,7 +101,8 @@ public 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.isInWeb(player))
|
&& !VersionUtil.isSlowFalling(player) && !Utilities.isInWeb(player)
|
||||||
|
&& movementManager.elytraEffectTicks <= 25)
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "had too little Y dropoff (diff="
|
return new CheckResult(CheckResult.Result.FAILED, "had too little Y dropoff (diff="
|
||||||
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
||||||
}
|
}
|
||||||
@@ -124,7 +122,8 @@ public class FlightCheck {
|
|||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
&& (!Utilities.isNearBed(distance.getTo())
|
&& (!Utilities.isNearBed(distance.getTo())
|
||||||
|| (Utilities.isNearBed(distance.getTo()) && movementManager.motionY > 0.12675)))
|
|| (Utilities.isNearBed(distance.getTo()) && movementManager.motionY > 0.12675))
|
||||||
|
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25)
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||||
|
|
||||||
@@ -134,7 +133,8 @@ public class FlightCheck {
|
|||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
&& !(Math.round(movementManager.motionY * 1000) == 425 && movementManager.airTicks == 11)
|
&& !(Math.round(movementManager.motionY * 1000) == 425 && movementManager.airTicks == 11)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
|
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25)
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
|
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
|
||||||
// End AirClimb
|
// End AirClimb
|
||||||
@@ -143,7 +143,7 @@ public class FlightCheck {
|
|||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "groundFlight") && movementManager.onGround
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "groundFlight") && movementManager.onGround
|
||||||
&& Utilities.cantStandAt(distance.getTo().getBlock().getRelative(BlockFace.DOWN))
|
&& Utilities.cantStandAt(distance.getTo().getBlock().getRelative(BlockFace.DOWN))
|
||||||
&& Utilities.cantStandAt(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
&& Utilities.cantStandAt(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
||||||
&& movementManager.groundTicks > 2) {
|
&& Utilities.cantStandAt(distance.getTo().getBlock()) && movementManager.groundTicks > 2) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
|
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ public class FlightCheck {
|
|||||||
&& movementManager.motionY < 0 && !backend.justVelocity(player)
|
&& movementManager.motionY < 0 && !backend.justVelocity(player)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
||||||
&& !Utilities.isInWeb(player)) {
|
&& !Utilities.isInWeb(player) && movementManager.elytraEffectTicks <= 25) {
|
||||||
double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
||||||
double offset = Math.abs(gravitatedY - movementManager.motionY);
|
double offset = Math.abs(gravitatedY - movementManager.motionY);
|
||||||
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class SpeedCheck {
|
|||||||
boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
||||||
|
|
||||||
// AirSpeed
|
// AirSpeed
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1 && movementManager.elytraEffectTicks <= 0) {
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1 && movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) {
|
||||||
double multiplier = 0.985D;
|
double multiplier = 0.985D;
|
||||||
double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
|
double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
|
||||||
double limit = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "baseLimit"); // Default 0.03125
|
double limit = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "baseLimit"); // Default 0.03125
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 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.check.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rammelkast
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class StrafeCheck {
|
||||||
|
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
|
public static CheckResult runCheck(Player player, double x, double z, Location from, Location to) {
|
||||||
|
if (!Utilities.cantStandAtExp(from) || !Utilities.cantStandAtExp(to) || Utilities.isNearWater(player)
|
||||||
|
|| Utilities.isNearClimbable(player))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
|
.getMovementManager();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig.getInteger(CheckType.STRAFE,
|
||||||
|
"accountForTeleports") || movementManager.elytraEffectTicks >= 20)
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
Vector oldAcceleration = new Vector(movementManager.lastDistanceX, 0, movementManager.lastDistanceZ);
|
||||||
|
Vector newAcceleration = new Vector(x, 0, z);
|
||||||
|
|
||||||
|
float angle = newAcceleration.angle(oldAcceleration);
|
||||||
|
double distance = newAcceleration.lengthSquared();
|
||||||
|
if (angle > checksConfig
|
||||||
|
.getDouble(CheckType.STRAFE, "maxAngleChange") && distance > checksConfig
|
||||||
|
.getDouble(CheckType.STRAFE, "minActivationDistance") && Utilities.cantStandFar(to.getBlock()))
|
||||||
|
return new CheckResult(Result.FAILED, "switched angle in air (angle=" + angle + ", dist=" + distance + ")");
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ public class WaterWalkCheck {
|
|||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
MovementManager movementManager = user.getMovementManager();
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
|
||||||
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null)
|
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player))
|
||||||
return PASS;
|
return PASS;
|
||||||
|
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|||||||
@@ -32,6 +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.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
public class BadPacketsCheck {
|
public class BadPacketsCheck {
|
||||||
@@ -39,9 +40,10 @@ public class BadPacketsCheck {
|
|||||||
public static void runCheck(Player player, PacketEvent event) {
|
public static void runCheck(Player player, PacketEvent event) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
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) || backend.isMovingExempt(player)) {
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS)
|
||||||
|
|| backend.isMovingExempt(player) || player.isDead())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
PacketContainer packet = event.getPacket();
|
PacketContainer packet = event.getPacket();
|
||||||
float pitch = packet.getFloat().read(1);
|
float pitch = packet.getFloat().read(1);
|
||||||
@@ -53,9 +55,11 @@ public class BadPacketsCheck {
|
|||||||
|
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (user.isLagging() || tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")) {
|
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
|
.getMovementManager();
|
||||||
|
if (user.isLagging() || tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")
|
||||||
|
|| (System.currentTimeMillis() - movementManager.lastTeleport <= 100))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
double x = packet.getDoubles().read(0);
|
double x = packet.getDoubles().read(0);
|
||||||
double y = packet.getDoubles().read(1);
|
double y = packet.getDoubles().read(1);
|
||||||
@@ -68,7 +72,8 @@ public class BadPacketsCheck {
|
|||||||
double maxDistance = checksConfig.getDouble(CheckType.BADPACKETS, "maxDistance");
|
double maxDistance = checksConfig.getDouble(CheckType.BADPACKETS, "maxDistance");
|
||||||
boolean hasNewLocation = packet.getBooleans().read(0);
|
boolean hasNewLocation = packet.getBooleans().read(0);
|
||||||
if (distance > maxDistance) {
|
if (distance > maxDistance) {
|
||||||
flag(player, event, "moved too far between packets (distance=" + new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP) + ", max=" + maxDistance + ")");
|
flag(player, event, "moved too far between packets (distance="
|
||||||
|
+ new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP) + ", max=" + maxDistance + ")");
|
||||||
return;
|
return;
|
||||||
} else if (distance < 1E-10 && !hasNewLocation) {
|
} else if (distance < 1E-10 && !hasNewLocation) {
|
||||||
// TODO this gives false positives when teleporting
|
// TODO this gives false positives when teleporting
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class CommandBase {
|
|||||||
execute(cs, args);
|
execute(cs, args);
|
||||||
} else {
|
} else {
|
||||||
if (args == null) {
|
if (args == null) {
|
||||||
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
|
cs.sendMessage(GRAY + "Running " + GOLD + "" + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
|
||||||
} else {
|
} else {
|
||||||
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,14 @@ public class EntityListener extends EventListener {
|
|||||||
noHack = false;
|
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);
|
||||||
|
noHack = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (noHack) {
|
if (noHack) {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
|
|||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
@@ -66,6 +65,7 @@ import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
|||||||
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
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.WaterWalkCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
@@ -486,6 +486,15 @@ public class PlayerListener extends EventListener {
|
|||||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (getCheckManager().willCheckQuick(player, CheckType.STRAFE)) {
|
||||||
|
CheckResult result = StrafeCheck.runCheck(player, x, z, event.getFrom(), event.getTo());
|
||||||
|
if (result.failed()) {
|
||||||
|
if (!silentMode()) {
|
||||||
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
|
}
|
||||||
|
log(result.getMessage(), player, CheckType.STRAFE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||||
|
|||||||
@@ -45,8 +45,16 @@ public class MovementManager {
|
|||||||
public double lastMotionY;
|
public double lastMotionY;
|
||||||
// Horizontal distance of movement
|
// Horizontal distance of movement
|
||||||
public double distanceXZ;
|
public double distanceXZ;
|
||||||
|
// Horizontal distance on x-axis of movement
|
||||||
|
public double distanceX;
|
||||||
|
// Horizontal distance on z-axis of movement
|
||||||
|
public double distanceZ;
|
||||||
// Previous horizontal distance of movement
|
// Previous horizontal distance of movement
|
||||||
public double lastDistanceXZ;
|
public double lastDistanceXZ;
|
||||||
|
// Previous horizontal distance on x-axis of movement
|
||||||
|
public double lastDistanceX;
|
||||||
|
// Previous horizontal distance on z-axis of movement
|
||||||
|
public double lastDistanceZ;
|
||||||
// If the player touched the ground again this tick
|
// If the player touched the ground again this tick
|
||||||
public boolean touchedGroundThisTick = false;
|
public boolean touchedGroundThisTick = false;
|
||||||
// Last recorded distance
|
// Last recorded distance
|
||||||
@@ -73,6 +81,8 @@ public class MovementManager {
|
|||||||
public int sneakingTicks;
|
public int sneakingTicks;
|
||||||
// Ticks counter after being near a liquid
|
// Ticks counter after being near a liquid
|
||||||
public int nearLiquidTicks;
|
public int nearLiquidTicks;
|
||||||
|
// Time of last update
|
||||||
|
public long lastUpdate;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void handle(Player player, Location from, Location to, Distance distance) {
|
public void handle(Player player, Location from, Location to, Distance distance) {
|
||||||
@@ -84,7 +94,11 @@ public class MovementManager {
|
|||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
this.lastDistanceXZ = this.distanceXZ;
|
this.lastDistanceXZ = this.distanceXZ;
|
||||||
|
this.lastDistanceX = this.distanceX;
|
||||||
|
this.lastDistanceZ = this.distanceZ;
|
||||||
this.distanceXZ = Math.sqrt(x * x + z * z);
|
this.distanceXZ = Math.sqrt(x * x + z * z);
|
||||||
|
this.distanceX = x;
|
||||||
|
this.distanceZ = z;
|
||||||
|
|
||||||
// Account for standing on boat
|
// Account for standing on boat
|
||||||
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
|
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
|
||||||
@@ -165,6 +179,7 @@ public class MovementManager {
|
|||||||
this.halfMovementHistoryCounter--;
|
this.halfMovementHistoryCounter--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.lastUpdate = System.currentTimeMillis();
|
||||||
// Update "good location"
|
// Update "good location"
|
||||||
AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).setGoodLocation(from);
|
AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).setGoodLocation(from);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public enum Permission {
|
|||||||
CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP, CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL,
|
CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP, CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL,
|
||||||
CHECK_KILLAURA, CHECK_UNICODE, CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY,
|
CHECK_KILLAURA, CHECK_UNICODE, CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY,
|
||||||
CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER,
|
CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER,
|
||||||
CHECK_AIMBOT,
|
CHECK_AIMBOT, CHECK_STRAFE,
|
||||||
|
|
||||||
/* System Nodes */
|
/* System Nodes */
|
||||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD,
|
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import org.bukkit.entity.Boat;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.BoundingBox;
|
||||||
import org.bukkit.util.NumberConversions;
|
import org.bukkit.util.NumberConversions;
|
||||||
|
|
||||||
public final class Utilities {
|
public final class Utilities {
|
||||||
@@ -226,6 +227,10 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHalfblock(Block block) {
|
public static boolean isHalfblock(Block block) {
|
||||||
|
BoundingBox box = block.getBoundingBox();
|
||||||
|
double height = box.getMaxY() - box.getMinY();
|
||||||
|
if (height > 0.42 && height <= 0.6 && block.getType().isSolid())
|
||||||
|
return true;
|
||||||
return isSlab(block) || isStair(block) || isWall(block) || block.getType() == Material.SNOW;
|
return isSlab(block) || isStair(block) || isWall(block) || block.getType() == Material.SNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,18 @@ speed:
|
|||||||
# Extra compensation when moving off a ladder up a slab
|
# Extra compensation when moving off a ladder up a slab
|
||||||
climbableCompensation: 0.04
|
climbableCompensation: 0.04
|
||||||
|
|
||||||
|
# Strafe check settings
|
||||||
|
# Checks if a player switches movement angle in air
|
||||||
|
strafe:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# How many milliseconds to account for teleports
|
||||||
|
accountForTeleports: 100
|
||||||
|
# Maximum angle change when moving in air
|
||||||
|
maxAngleChange: 0.25
|
||||||
|
# Minimum movement distance for the strafe check to be active
|
||||||
|
minActivationDistance: 0.025
|
||||||
|
|
||||||
# WaterWalk check settings
|
# WaterWalk check settings
|
||||||
# Checks if a player is walking on water
|
# Checks if a player is walking on water
|
||||||
waterwalk:
|
waterwalk:
|
||||||
@@ -170,6 +182,18 @@ killaura:
|
|||||||
# Amount of illegally angled hits before flagging
|
# Amount of illegally angled hits before flagging
|
||||||
vlBeforeFlag: 3
|
vlBeforeFlag: 3
|
||||||
|
|
||||||
|
# Checks if the player has a suspicious packet order
|
||||||
|
# Debugs as 'suspicious packet order'
|
||||||
|
packetOrder:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum server TPS needed for BadPackets to be active
|
||||||
|
minimumTps: 17.5
|
||||||
|
# Minimum elapsed time in milliseconds between a movement packet and a combat packet
|
||||||
|
minElapsedTime: 5
|
||||||
|
# Amount of suspicious combat packet situations before flagging
|
||||||
|
vlBeforeFlag: 3
|
||||||
|
|
||||||
# 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:
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ ALERT:
|
|||||||
WARNING:
|
WARNING:
|
||||||
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
||||||
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
|
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
|
||||||
BAN_REASON: '&6&lACR &8> &7Banned by AntiCheatReloaded'
|
BAN_REASON: '&6&lACR &8> &7Banned for unfair advantage'
|
||||||
BAN_BROADCAST: '&6&lACR &8> &7%player% was banned for cheating'
|
BAN_BROADCAST: '&6&lACR &8> &7%player% was banned for cheating'
|
||||||
KICK_REASON: '&6&lACR &8> &7Kicked for cheating'
|
KICK_REASON: '&6&lACR &8> &7Kicked for unfair advantage'
|
||||||
KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for cheating'
|
KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for cheating'
|
||||||
SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
|
SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
|
||||||
SPAM_KICK_REASON: '&cKicked for spamming'
|
SPAM_KICK_REASON: '&cKicked for spamming'
|
||||||
|
|||||||
@@ -127,6 +127,9 @@ permissions:
|
|||||||
anticheat.check.aimbot:
|
anticheat.check.aimbot:
|
||||||
description: Allow players to use aimbot
|
description: Allow players to use aimbot
|
||||||
default: false
|
default: false
|
||||||
|
anticheat.check.aimbot:
|
||||||
|
description: Allow players to use strafe hacks
|
||||||
|
default: false
|
||||||
anticheat.check.exempt:
|
anticheat.check.exempt:
|
||||||
description: Total exemption from checks
|
description: Total exemption from checks
|
||||||
default: false
|
default: false
|
||||||
@@ -158,3 +161,4 @@ permissions:
|
|||||||
anticheat.check.illegalinteract: true
|
anticheat.check.illegalinteract: true
|
||||||
anticheat.check.fastladder: true
|
anticheat.check.fastladder: true
|
||||||
anticheat.check.aimbot: true
|
anticheat.check.aimbot: true
|
||||||
|
anticheat.check.strafe: true
|
||||||
Reference in new issue
Block a user