mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16c778c17f | ||
|
|
97534e5df0 | ||
|
|
e770d0e01c | ||
|
|
a59a4baf28 | ||
|
|
7caf7376ba | ||
|
|
a6a39e352a | ||
|
|
700c0145f3 | ||
|
|
c74fc92da9 | ||
|
|
3bc49141fc | ||
|
|
cffd6d07ae | ||
|
|
e9a99f0463 | ||
|
|
4deb8ae0fb | ||
|
|
07f957cf35 |
No files matched your search
@@ -38,7 +38,8 @@ Hacks blocked
|
||||
* FastBow
|
||||
* FastEat
|
||||
* FastHeal
|
||||
* KillAura (Aimbot)
|
||||
* KillAura
|
||||
* Aimbot
|
||||
* Reach
|
||||
* Unicode chat
|
||||
* FastProjectile
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.9.0</version>
|
||||
<version>1.9.3</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||
<properties>
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@@ -153,6 +154,7 @@ public class Backend {
|
||||
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
||||
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
|
||||
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
|
||||
KillAuraCheck.PACKETORDER_FLAGS.remove(uuid);
|
||||
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
||||
}
|
||||
|
||||
@@ -229,7 +231,8 @@ public class Backend {
|
||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
||||
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
||||
&& !VersionUtil.isSlowFalling(player)) {
|
||||
&& !VersionUtil.isSlowFalling(player) && !Utilities
|
||||
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation())) {
|
||||
if (player.getFallDistance() == 0) {
|
||||
if (nofallViolation.get(uuid) == null) {
|
||||
nofallViolation.put(uuid, 1);
|
||||
|
||||
@@ -62,7 +62,8 @@ public enum CheckType {
|
||||
CHAT_UNICODE(Permission.CHECK_UNICODE, "ChatUnicode"),
|
||||
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT, "IllegalInteract"),
|
||||
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 String displayName;
|
||||
|
||||
@@ -32,7 +32,9 @@ 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.User;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
@@ -40,6 +42,8 @@ public class KillAuraCheck {
|
||||
|
||||
// Angle check
|
||||
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);
|
||||
|
||||
public static CheckResult checkReach(Player player, Entity target) {
|
||||
@@ -118,6 +122,39 @@ public class KillAuraCheck {
|
||||
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) {
|
||||
Location clonedFrom = from.clone();
|
||||
Vector startVector = clonedFrom.toVector();
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class ElytraCheck {
|
||||
@@ -38,10 +39,9 @@ public class ElytraCheck {
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult runCheck(Player player, Distance distance) {
|
||||
// No elytra in server version
|
||||
if (VersionUtil.isBountifulUpdate()) {
|
||||
// No elytra in server version or not relevant
|
||||
if (VersionUtil.isBountifulUpdate() || Utilities.isNearWater(player))
|
||||
return PASS;
|
||||
}
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
|
||||
|
||||
@@ -49,8 +49,10 @@ public class FlightCheck {
|
||||
|
||||
public static CheckResult runCheck(Player player, Distance distance) {
|
||||
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||
|| VersionUtil.isFlying(player)) {
|
||||
// This was a teleport or user is flying/using elytra, so we don't care
|
||||
|| VersionUtil.isFlying(player) || player.getVehicle() != null
|
||||
|| AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)) {
|
||||
// This was a teleport or user is flying/using elytra/in a vehicle, so we don't
|
||||
// care
|
||||
// about it.
|
||||
return PASS;
|
||||
}
|
||||
@@ -60,23 +62,19 @@ public class FlightCheck {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
|
||||
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement
|
||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.UP)))
|
||||
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement || Utilities.isNearClimbable(player))
|
||||
return PASS;
|
||||
|
||||
int minAirTicks = 13;
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||
minAirTicks += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 3;
|
||||
}
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||
minAirTicks += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 3;
|
||||
|
||||
if (movementManager.halfMovementHistoryCounter > 25)
|
||||
minAirTicks += 5;
|
||||
|
||||
// Start AirFlight
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
||||
&& !backend.justVelocity(player)) {
|
||||
&& !backend.justVelocity(player) && movementManager.elytraEffectTicks <= 25) {
|
||||
// Config default base is 1200ms
|
||||
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
||||
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||
@@ -90,7 +88,12 @@ public class FlightCheck {
|
||||
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
||||
: (blockPlaceAccountingTime + 1);
|
||||
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0)
|
||||
// Fixes snow false positive
|
||||
if (movementManager.motionY < 0.004 && Utilities
|
||||
.isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation()))
|
||||
maxMotionY = 0.004D;
|
||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0
|
||||
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0)))
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||
|
||||
@@ -98,18 +101,20 @@ public class FlightCheck {
|
||||
&& !Utilities.couldBeOnBoat(player)
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.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="
|
||||
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
||||
}
|
||||
// End AirFlight
|
||||
|
||||
// Start AirClimb
|
||||
// TODO two hardcoded values here shouldn't be there, temp against false
|
||||
// TODO three hardcoded values here shouldn't be there, temp against false
|
||||
// positive
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
||||
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
||||
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
||||
&& Math.round(movementManager.motionY * 1000) != 248
|
||||
&& !(Math.round(movementManager.motionY * 1000) == 333
|
||||
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
||||
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||
@@ -117,24 +122,29 @@ public class FlightCheck {
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||
&& (!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,
|
||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||
|
||||
// TODO hardcoded value against false again..
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
||||
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||
&& !(Math.round(movementManager.motionY * 1000) == 425 && movementManager.airTicks == 11)
|
||||
&& (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,
|
||||
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
|
||||
}
|
||||
// End AirClimb
|
||||
|
||||
// Start GroundFlight
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "groundFlight") && movementManager.onGround
|
||||
&& Utilities.cantStandAt(distance.getTo().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,
|
||||
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
|
||||
}
|
||||
@@ -145,7 +155,7 @@ public class FlightCheck {
|
||||
&& movementManager.motionY < 0 && !backend.justVelocity(player)
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
||||
&& !Utilities.isInWeb(player)) {
|
||||
&& !Utilities.isInWeb(player) && movementManager.elytraEffectTicks <= 25) {
|
||||
double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
||||
double offset = Math.abs(gravitatedY - movementManager.motionY);
|
||||
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
/**
|
||||
* @author Rammelkast
|
||||
* TODO soulsand speed
|
||||
* TODO fix false positive with water weeds
|
||||
*/
|
||||
public class SpeedCheck {
|
||||
|
||||
@@ -58,7 +57,7 @@ public class SpeedCheck {
|
||||
boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
||||
|
||||
// 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 predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
|
||||
double limit = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "baseLimit"); // Default 0.03125
|
||||
@@ -87,10 +86,10 @@ public class SpeedCheck {
|
||||
}
|
||||
// Adjust for speed effects
|
||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||
predict += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.05D;
|
||||
predict += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D;
|
||||
// Adjust for jump boost effects
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||
predict += (player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1) * 0.05D;
|
||||
predict += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.05D;
|
||||
// Adjust for custom walking speed
|
||||
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default 1.4
|
||||
predict += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
||||
@@ -100,7 +99,7 @@ public class SpeedCheck {
|
||||
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0)
|
||||
predict *= 1.25D;
|
||||
// Boats sometimes give a false positive
|
||||
if (Utilities.couldBeOnBoat(player, 0.5))
|
||||
if (Utilities.couldBeOnBoat(player, 0.5, true))
|
||||
predict *= 1.25D;
|
||||
// Strafing in air when nearing terminal velocity gives false positives
|
||||
// This fixes the issue but gives hackers some leniency which means we need another check for this
|
||||
@@ -137,7 +136,7 @@ public class SpeedCheck {
|
||||
limit *= 1.05D;
|
||||
// Adjust for speed effects
|
||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.0225D;
|
||||
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D;
|
||||
// Adjust for slabs
|
||||
if (movementManager.halfMovementHistoryCounter > 15)
|
||||
limit *= 2.0D;
|
||||
@@ -184,7 +183,7 @@ public class SpeedCheck {
|
||||
limit *= 1.1D;
|
||||
// Adjust for speed effects
|
||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.06D;
|
||||
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.06D;
|
||||
if (movementManager.iceInfluenceTicks >= 50) {
|
||||
// When moving off ice
|
||||
if (!Utilities.couldBeOnIce(movingTowards))
|
||||
@@ -229,18 +228,15 @@ public class SpeedCheck {
|
||||
|
||||
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (isSpeedExempt(player, backend) || player.getVehicle() != null || player.isSleeping()
|
||||
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player))
|
||||
return PASS;
|
||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||
.getMovementManager();
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
||||
return PASS;
|
||||
|
||||
if (player.isInsideVehicle() || player.isSleeping()
|
||||
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_EXTENSION()) || VersionUtil.isFlying(player)
|
||||
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player)) {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
||||
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), movementManager.halfMovement, checksConfig);
|
||||
@@ -257,12 +253,12 @@ public class SpeedCheck {
|
||||
private static double getMaxAcceptableMotionY(Player player, boolean nearBed, boolean couldBeOnBoat, boolean fromClimbable, boolean halfMovement, 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.600000025 : (nearBed ? 0.5625 : (halfMovement ? 0.6 : 0.42));
|
||||
double base = couldBeOnBoat ? 0.600000025 : (nearBed ? 0.5625 : ((halfMovement || VersionUtil.isBountifulUpdate()) ? 0.6 : 0.42));
|
||||
if (fromClimbable)
|
||||
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||
base += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 0.2D;
|
||||
}
|
||||
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||
base += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.2D;
|
||||
return base;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class WaterWalkCheck {
|
||||
|
||||
@@ -42,28 +43,31 @@ public class WaterWalkCheck {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||
MovementManager movementManager = user.getMovementManager();
|
||||
|
||||
if (movementManager.distanceXZ <= 0)
|
||||
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player)
|
||||
|| VersionUtil.isRiptiding(player) || VersionUtil.isSwimming(player))
|
||||
return PASS;
|
||||
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
Block blockBeneath = player.getLocation().clone().subtract(0, 0.1, 0).getBlock();
|
||||
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
||||
&& Utilities.isSurroundedByWater(player)
|
||||
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0) || movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ"))
|
||||
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0)
|
||||
|| movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ")
|
||||
&& !movementManager.topSolid && !Utilities.couldBeOnBoat(player, 3, false))
|
||||
return new CheckResult(Result.FAILED,
|
||||
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
|
||||
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
|
||||
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
|
||||
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY"))
|
||||
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY")
|
||||
&& !Utilities.couldBeOnBoat(player, 0.3, false))
|
||||
return new CheckResult(Result.FAILED,
|
||||
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
||||
|
||||
double minAbsMotionY = 0.12D;
|
||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||
minAbsMotionY += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.05D;
|
||||
minAbsMotionY += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D;
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid()
|
||||
&& Utilities.isSurroundedByWater(player)
|
||||
&& Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
public class BadPacketsCheck {
|
||||
@@ -39,9 +40,10 @@ public class BadPacketsCheck {
|
||||
public static void runCheck(Player player, PacketEvent event) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
// 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;
|
||||
}
|
||||
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
PacketContainer packet = event.getPacket();
|
||||
float pitch = packet.getFloat().read(1);
|
||||
@@ -50,13 +52,15 @@ public class BadPacketsCheck {
|
||||
flag(player, event, "had an illegal pitch");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
double x = packet.getDoubles().read(0);
|
||||
double y = packet.getDoubles().read(1);
|
||||
double z = packet.getDoubles().read(2);
|
||||
@@ -68,12 +72,13 @@ public class BadPacketsCheck {
|
||||
double maxDistance = checksConfig.getDouble(CheckType.BADPACKETS, "maxDistance");
|
||||
boolean hasNewLocation = packet.getBooleans().read(0);
|
||||
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;
|
||||
} else if (distance < 1E-10 && !hasNewLocation) {
|
||||
// TODO this gives false positives when teleporting
|
||||
// Only found this in 1.8.8 though
|
||||
//flag(player, event, "sent the same packet twice");
|
||||
// flag(player, event, "sent the same packet twice");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CommandBase {
|
||||
execute(cs, args);
|
||||
} else {
|
||||
if (args == null) {
|
||||
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
|
||||
cs.sendMessage(GRAY + "Running " + GOLD + "" + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
|
||||
} else {
|
||||
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class Config extends ConfigurationFile {
|
||||
public ConfigValue<List<String>> disabledWorlds;
|
||||
|
||||
public ConfigValue<Integer> notifyEveryVl;
|
||||
public ConfigValue<Integer> maxSetbackDistance;
|
||||
|
||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
@@ -85,5 +86,10 @@ public class Config extends ConfigurationFile {
|
||||
if (notifyEveryVl.getValue() < 1) {
|
||||
notifyEveryVl.setValue(5);
|
||||
}
|
||||
|
||||
maxSetbackDistance = new ConfigValue<Integer>("system.max-setback-distance");
|
||||
if (maxSetbackDistance.getValue() < 5) {
|
||||
maxSetbackDistance.setValue(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
@@ -134,29 +135,36 @@ public class EntityListener extends EventListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.getDamager() instanceof Player) {
|
||||
Player player = (Player) e.getDamager();
|
||||
getBackend().logDamage(player, 1);
|
||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
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);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (noHack) {
|
||||
decrease(player);
|
||||
}
|
||||
}
|
||||
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);
|
||||
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);
|
||||
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) {
|
||||
decrease(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
|
||||
@@ -65,6 +65,7 @@ import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||
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.player.IllegalInteract;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
@@ -256,9 +257,6 @@ public class PlayerListener extends EventListener {
|
||||
@EventHandler
|
||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!event.isSprinting()) {
|
||||
getBackend().logEnterExit(player);
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
||||
CheckResult result = getBackend().checkSprintHungry(event);
|
||||
if (result.failed()) {
|
||||
@@ -436,7 +434,6 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
boolean changed = false;
|
||||
if (event.getTo() != event.getFrom()) {
|
||||
double x = distance.getXDifference();
|
||||
double z = distance.getZDifference();
|
||||
@@ -449,7 +446,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPEED);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
||||
@@ -458,7 +454,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPEED);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
||||
@@ -469,7 +464,6 @@ public class PlayerListener extends EventListener {
|
||||
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.WATER_WALK);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
||||
@@ -479,7 +473,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPIDER);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||
@@ -491,11 +484,16 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (!changed) {
|
||||
user.setGoodLocation(event.getFrom());
|
||||
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)) {
|
||||
|
||||
@@ -21,6 +21,8 @@ package com.rammelkast.anticheatreloaded.util;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
public class MovementManager {
|
||||
|
||||
// Ticks in air
|
||||
@@ -43,8 +45,16 @@ public class MovementManager {
|
||||
public double lastMotionY;
|
||||
// Horizontal distance of movement
|
||||
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
|
||||
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
|
||||
public boolean touchedGroundThisTick = false;
|
||||
// Last recorded distance
|
||||
@@ -71,6 +81,8 @@ public class MovementManager {
|
||||
public int sneakingTicks;
|
||||
// Ticks counter after being near a liquid
|
||||
public int nearLiquidTicks;
|
||||
// Time of last update
|
||||
public long lastUpdate;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void handle(Player player, Location from, Location to, Distance distance) {
|
||||
@@ -78,16 +90,20 @@ public class MovementManager {
|
||||
// This is checked for spoofing by "GroundFlight"
|
||||
// Also seems to make NoFall cheats flag for speed lmao
|
||||
this.onGround = player.isOnGround();
|
||||
|
||||
|
||||
double x = distance.getXDifference();
|
||||
double z = distance.getZDifference();
|
||||
this.lastDistanceXZ = this.distanceXZ;
|
||||
double z = distance.getZDifference();
|
||||
this.lastDistanceXZ = this.distanceXZ;
|
||||
this.lastDistanceX = this.distanceX;
|
||||
this.lastDistanceZ = this.distanceZ;
|
||||
this.distanceXZ = Math.sqrt(x * x + z * z);
|
||||
|
||||
this.distanceX = x;
|
||||
this.distanceZ = z;
|
||||
|
||||
// Account for standing on boat
|
||||
if (Utilities.couldBeOnBoat(player, 0.25))
|
||||
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
|
||||
this.onGround = true;
|
||||
|
||||
|
||||
this.touchedGroundThisTick = false;
|
||||
this.halfMovement = false;
|
||||
if (!this.onGround) {
|
||||
@@ -100,7 +116,7 @@ public class MovementManager {
|
||||
this.airTicks = 0;
|
||||
this.groundTicks++;
|
||||
}
|
||||
|
||||
|
||||
if (Utilities.couldBeOnIce(to)) {
|
||||
this.iceTicks++;
|
||||
this.iceInfluenceTicks = 60;
|
||||
@@ -109,7 +125,7 @@ public class MovementManager {
|
||||
if (this.iceInfluenceTicks > 0)
|
||||
this.iceInfluenceTicks--;
|
||||
}
|
||||
|
||||
|
||||
if (Utilities.couldBeOnSlime(to)) {
|
||||
this.slimeTicks++;
|
||||
this.slimeInfluenceTicks = 40;
|
||||
@@ -118,19 +134,19 @@ public class MovementManager {
|
||||
if (this.slimeInfluenceTicks > 0)
|
||||
this.slimeInfluenceTicks--;
|
||||
}
|
||||
|
||||
|
||||
if (VersionUtil.isGliding(player)) {
|
||||
this.elytraEffectTicks = 30;
|
||||
} else {
|
||||
if (this.elytraEffectTicks > 0)
|
||||
this.elytraEffectTicks--;
|
||||
}
|
||||
|
||||
|
||||
if (player.isSneaking())
|
||||
this.sneakingTicks++;
|
||||
else
|
||||
this.sneakingTicks = 0;
|
||||
|
||||
|
||||
if (Utilities.isNearWater(player))
|
||||
this.nearLiquidTicks = 8;
|
||||
else {
|
||||
@@ -139,27 +155,32 @@ public class MovementManager {
|
||||
else
|
||||
this.nearLiquidTicks = 0;
|
||||
}
|
||||
|
||||
|
||||
double lastDistanceSq = Math.sqrt(this.lastDistance.getXDifference() * this.lastDistance.getXDifference()
|
||||
+ this.lastDistance.getZDifference() * this.lastDistance.getZDifference());
|
||||
double currentDistanceSq = Math.sqrt(distance.getXDifference() * distance.getXDifference()
|
||||
+ distance.getZDifference() * distance.getZDifference());
|
||||
this.acceleration = currentDistanceSq - lastDistanceSq;
|
||||
|
||||
|
||||
this.lastMotionY = this.motionY;
|
||||
this.motionY = to.getY() - from.getY();
|
||||
|
||||
|
||||
Location top = to.clone().add(0, 2, 0);
|
||||
this.topSolid = top.getBlock().getType().isSolid();
|
||||
Location bottom = to.clone().add(0, -1, 0);
|
||||
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
||||
|
||||
if ((this.motionY > 0.464D && this.motionY <= 0.5625D) && (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
||||
|
||||
if ((this.motionY > 0.42D && this.motionY <= 0.5625D)
|
||||
&& (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
||||
this.halfMovement = true;
|
||||
this.halfMovementHistoryCounter = 30;
|
||||
} else {
|
||||
if (this.halfMovementHistoryCounter > 0)
|
||||
this.halfMovementHistoryCounter--;
|
||||
}
|
||||
|
||||
this.lastUpdate = System.currentTimeMillis();
|
||||
// Update "good location"
|
||||
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_KILLAURA, CHECK_UNICODE, CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY,
|
||||
CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER,
|
||||
CHECK_AIMBOT,
|
||||
CHECK_AIMBOT, CHECK_STRAFE,
|
||||
|
||||
/* System Nodes */
|
||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD,
|
||||
|
||||
@@ -217,7 +217,8 @@ public class User {
|
||||
* @return last known valid location
|
||||
*/
|
||||
public Location getGoodLocation(Location location) {
|
||||
if (goodLocation == null) {
|
||||
if (goodLocation == null || !location.getWorld().equals(goodLocation.getWorld())
|
||||
|| location.distance(goodLocation) > config.getConfig().maxSetbackDistance.getValue()) {
|
||||
return location;
|
||||
}
|
||||
|
||||
@@ -457,7 +458,8 @@ public class User {
|
||||
}
|
||||
|
||||
public boolean isLagging() {
|
||||
return Math.abs(this.ping - this.lastPing) > config.getMagic().LAG_DETERMINATION();
|
||||
return Math.abs(this.ping - this.lastPing) > config.getMagic().LAG_DETERMINATION()
|
||||
&& this.ping > config.getMagic().LAG_DETERMINATION();
|
||||
}
|
||||
|
||||
public MovementManager getMovementManager() {
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
public final class Utilities {
|
||||
@@ -47,7 +48,6 @@ public final class Utilities {
|
||||
|
||||
public static final Material LILY_PAD;
|
||||
public static final Material COB_WEB;
|
||||
public static final Material IRON_BARS;
|
||||
|
||||
public static final double JUMP_MOTION_Y = 0.41999998688697815;
|
||||
|
||||
@@ -124,17 +124,22 @@ public final class Utilities {
|
||||
}
|
||||
|
||||
public static boolean couldBeOnBoat(Player player) {
|
||||
return couldBeOnBoat(player, 0.35);
|
||||
return couldBeOnBoat(player, 0.35, false);
|
||||
}
|
||||
|
||||
public static boolean couldBeOnBoat(Player player, double range) {
|
||||
public static boolean couldBeOnBoat(Player player, double range, boolean checkY) {
|
||||
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
||||
if (entity instanceof Boat)
|
||||
return true;
|
||||
if (entity instanceof Boat) {
|
||||
if (((Boat) entity).getLocation().getY() < player.getLocation().getY() + 0.25) {
|
||||
return true;
|
||||
} else if (!checkY) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a player could be standing on ice
|
||||
*
|
||||
@@ -171,6 +176,31 @@ public final class Utilities {
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a block is a shulker box
|
||||
*
|
||||
* @param block block to check
|
||||
* @return true if block is a shulker box
|
||||
*/
|
||||
public static boolean isShulkerBox(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("SHULKER_BOX");
|
||||
}
|
||||
|
||||
public static boolean isNearShulkerBox(Location location) {
|
||||
if (VersionUtil.isBountifulUpdate())
|
||||
return false;
|
||||
return isShulkerBox(location.getBlock())
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.EAST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.WEST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player could be standing on a halfblock
|
||||
*
|
||||
@@ -196,7 +226,13 @@ public final class Utilities {
|
||||
}
|
||||
|
||||
public static boolean isHalfblock(Block block) {
|
||||
return isSlab(block) || isStair(block) || isWall(block);
|
||||
if (!VersionUtil.isBountifulUpdate()) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +413,7 @@ public final class Utilities {
|
||||
*/
|
||||
public static boolean isWall(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("WALL");
|
||||
return type.name().endsWith("WALL") || type.name().endsWith("FENCE");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -500,6 +536,22 @@ public final class Utilities {
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.EAST))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a location is near a climbable block
|
||||
*
|
||||
* @param location location to check
|
||||
* @return true if near climbable block
|
||||
*/
|
||||
public static boolean isNearClimbable(Location location) {
|
||||
return isClimbableBlock(location.getBlock())
|
||||
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.DOWN))
|
||||
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.UP))
|
||||
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.EAST))
|
||||
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a block is climbable
|
||||
@@ -713,7 +765,6 @@ public final class Utilities {
|
||||
if (VersionUtil.isBountifulUpdate()) {
|
||||
LILY_PAD = XMaterial.LILY_PAD.parseMaterial();
|
||||
COB_WEB = XMaterial.COBWEB.parseMaterial();
|
||||
IRON_BARS = XMaterial.IRON_BARS.parseMaterial();
|
||||
|
||||
// Start instant break materials
|
||||
INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial());
|
||||
@@ -797,7 +848,6 @@ public final class Utilities {
|
||||
else {
|
||||
LILY_PAD = Material.LILY_PAD;
|
||||
COB_WEB = Material.COBWEB;
|
||||
IRON_BARS = Material.IRON_BARS;
|
||||
|
||||
// Start instant break materials
|
||||
INSTANT_BREAK.add(Material.COMPARATOR);
|
||||
@@ -936,7 +986,8 @@ public final class Utilities {
|
||||
CLIMBABLE.add(Material.LADDER);
|
||||
CLIMBABLE.add(Material.WATER);
|
||||
// Start 1.14 objects
|
||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15") || VersionUtil.isOfVersion("v1_16")) {
|
||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")
|
||||
|| VersionUtil.isOfVersion("v1_16")) {
|
||||
CLIMBABLE.add(Material.SCAFFOLDING);
|
||||
}
|
||||
// End 1.14 objects
|
||||
@@ -946,7 +997,7 @@ public final class Utilities {
|
||||
CLIMBABLE.add(XMaterial.TWISTING_VINES.parseMaterial());
|
||||
CLIMBABLE.add(XMaterial.TWISTING_VINES_PLANT.parseMaterial());
|
||||
CLIMBABLE.add(XMaterial.WEEPING_VINES.parseMaterial());
|
||||
CLIMBABLE.add(XMaterial.TWISTING_VINES_PLANT.parseMaterial());
|
||||
CLIMBABLE.add(XMaterial.WEEPING_VINES_PLANT.parseMaterial());
|
||||
}
|
||||
// End 1.16 objects
|
||||
// End climbable
|
||||
|
||||
@@ -134,4 +134,24 @@ public class VersionUtil {
|
||||
return effect.getType().equals(PotionEffectType.LEVITATION);
|
||||
}
|
||||
|
||||
public static int getPotionLevel(Player player, PotionEffectType type) {
|
||||
if (isBountifulUpdate()) {
|
||||
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||
if (effect.getType().equals(type))
|
||||
return effect.getAmplifier() + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (player.hasPotionEffect(type))
|
||||
return player.getPotionEffect(type).getAmplifier() + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean isSwimming(Player player) {
|
||||
if (isBountifulUpdate()) {
|
||||
return false;
|
||||
}
|
||||
return player.isSwimming();
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,18 @@ speed:
|
||||
# Extra compensation when moving off a ladder up a slab
|
||||
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
|
||||
# Checks if a player is walking on water
|
||||
waterwalk:
|
||||
@@ -170,6 +182,18 @@ killaura:
|
||||
# Amount of illegally angled hits before flagging
|
||||
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
|
||||
# Checks if the player is sending aimbot-like movements
|
||||
aimbot:
|
||||
@@ -192,7 +216,7 @@ velocity:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
# Minimum percentage of the given knockback a player has to meet
|
||||
minimumPercentage: 98
|
||||
minimumPercentage: 75
|
||||
# Amount of low-velocity moments before flagging
|
||||
vlBeforeFlag: 2
|
||||
|
||||
|
||||
@@ -38,7 +38,11 @@ system:
|
||||
# Minimum value is 1, default is 8
|
||||
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
||||
notify-every-vl: 8
|
||||
# Use /AntiCheatReloaded checks for a list of valid checks
|
||||
# Maximum distance a player can be set back
|
||||
# If the last known valid location is further away than this,
|
||||
# the player will be rubberbanded at their current location
|
||||
# Minimum value is 5, default is 50
|
||||
max-setback-distance: 50
|
||||
disable-in:
|
||||
- example-world
|
||||
- example-world-2
|
||||
@@ -6,9 +6,9 @@ ALERT:
|
||||
WARNING:
|
||||
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
||||
- '&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'
|
||||
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'
|
||||
SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
|
||||
SPAM_KICK_REASON: '&cKicked for spamming'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Time to exempt a player from moving because of entering/exiting a vehicle
|
||||
# Increase in case of false positives
|
||||
ENTERED_EXITED_TIME: 1000
|
||||
ENTERED_EXITED_TIME: 250
|
||||
# Time to exempt a player from moving because of teleporting
|
||||
# Increase in case of false positives
|
||||
TELEPORT_TIME: 1000
|
||||
TELEPORT_TIME: 1500
|
||||
# Time to exempt a player from moving because of exiting fly mode
|
||||
# Changing this value is almost never required
|
||||
EXIT_FLY_TIME: 2000
|
||||
@@ -26,9 +26,9 @@ EXPLOSION_DAMAGE_TIME: 5000
|
||||
# Amount of seconds to extend a players velocitized state after receiving velocity again
|
||||
VELOCITY_EXTENSION: 2
|
||||
# Time a player is considered to have a change in velocity
|
||||
VELOCITY_TIME: 2000
|
||||
VELOCITY_TIME: 1000
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_PREVENT: 5000
|
||||
VELOCITY_PREVENT: 2000
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_MAXTIMES: 2
|
||||
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
||||
|
||||
@@ -127,6 +127,9 @@ permissions:
|
||||
anticheat.check.aimbot:
|
||||
description: Allow players to use aimbot
|
||||
default: false
|
||||
anticheat.check.aimbot:
|
||||
description: Allow players to use strafe hacks
|
||||
default: false
|
||||
anticheat.check.exempt:
|
||||
description: Total exemption from checks
|
||||
default: false
|
||||
@@ -157,4 +160,5 @@ permissions:
|
||||
anticheat.check.unicode: true
|
||||
anticheat.check.illegalinteract: true
|
||||
anticheat.check.fastladder: true
|
||||
anticheat.check.aimbot: true
|
||||
anticheat.check.aimbot: true
|
||||
anticheat.check.strafe: true
|
||||
Reference in new issue
Block a user