Compare commits

..
5 Commits
8 changed files with 67 additions and 27 deletions

No files matched your search

+2 -1
View File
@@ -38,7 +38,8 @@ Hacks blocked
* FastBow * FastBow
* FastEat * FastEat
* FastHeal * FastHeal
* KillAura (Aimbot) * KillAura
* Aimbot
* Reach * Reach
* Unicode chat * Unicode chat
* FastProjectile * FastProjectile
+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.rammelkast.anticheatreloaded</groupId> <groupId>com.rammelkast.anticheatreloaded</groupId>
<artifactId>AntiCheatReloaded</artifactId> <artifactId>AntiCheatReloaded</artifactId>
<version>1.9.2</version> <version>1.9.3</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>
@@ -66,9 +66,8 @@ public class FlightCheck {
return PASS; return PASS;
int minAirTicks = 13; int minAirTicks = 13;
if (player.hasPotionEffect(PotionEffectType.JUMP)) { if (player.hasPotionEffect(PotionEffectType.JUMP))
minAirTicks += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 3; minAirTicks += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 3;
}
if (movementManager.halfMovementHistoryCounter > 25) if (movementManager.halfMovementHistoryCounter > 25)
minAirTicks += 5; minAirTicks += 5;
@@ -93,7 +92,8 @@ public class FlightCheck {
if (movementManager.motionY < 0.004 && Utilities if (movementManager.motionY < 0.004 && Utilities
.isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation())) .isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation()))
maxMotionY = 0.004D; maxMotionY = 0.004D;
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0) if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0)))
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")"); "tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
@@ -134,9 +134,10 @@ public class FlightCheck {
&& !(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) && 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
// Start GroundFlight // Start GroundFlight
@@ -86,10 +86,10 @@ public class SpeedCheck {
} }
// Adjust for speed effects // Adjust for speed effects
if (player.hasPotionEffect(PotionEffectType.SPEED)) 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 // Adjust for jump boost effects
if (player.hasPotionEffect(PotionEffectType.JUMP)) 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 // Adjust for custom walking speed
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default 1.4 double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default 1.4
predict += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1); predict += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
@@ -136,7 +136,7 @@ public class SpeedCheck {
limit *= 1.05D; limit *= 1.05D;
// Adjust for speed effects // Adjust for speed effects
if (player.hasPotionEffect(PotionEffectType.SPEED)) 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 // Adjust for slabs
if (movementManager.halfMovementHistoryCounter > 15) if (movementManager.halfMovementHistoryCounter > 15)
limit *= 2.0D; limit *= 2.0D;
@@ -183,7 +183,7 @@ public class SpeedCheck {
limit *= 1.1D; limit *= 1.1D;
// Adjust for speed effects // Adjust for speed effects
if (player.hasPotionEffect(PotionEffectType.SPEED)) 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) { if (movementManager.iceInfluenceTicks >= 50) {
// When moving off ice // When moving off ice
if (!Utilities.couldBeOnIce(movingTowards)) if (!Utilities.couldBeOnIce(movingTowards))
@@ -253,12 +253,12 @@ public class SpeedCheck {
private static double getMaxAcceptableMotionY(Player player, boolean nearBed, boolean couldBeOnBoat, boolean fromClimbable, boolean halfMovement, Checks checksConfig) { private static double getMaxAcceptableMotionY(Player player, boolean nearBed, boolean couldBeOnBoat, boolean fromClimbable, boolean halfMovement, Checks checksConfig) {
// TODO config for these values // TODO config for these values
// TODO something funky vanilla stuff going on with 0.42, like 0.445.., check this.. // 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) if (fromClimbable)
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04 base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
if (player.hasPotionEffect(PotionEffectType.JUMP)) if (player.hasPotionEffect(PotionEffectType.JUMP))
base += (player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1) * 0.2D; base += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.2D;
return base; return base;
} }
@@ -32,6 +32,7 @@ import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.MovementManager; import com.rammelkast.anticheatreloaded.util.MovementManager;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class WaterWalkCheck { public class WaterWalkCheck {
@@ -42,12 +43,12 @@ 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 || Utilities.isOnLilyPad(player)) if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player)
|| VersionUtil.isRiptiding(player) || VersionUtil.isSwimming(player))
return PASS; return PASS;
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks(); Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
Block blockBeneath = player.getLocation().clone().subtract(0, 0.1, 0).getBlock(); Block blockBeneath = player.getLocation().clone().subtract(0, 0.1, 0).getBlock();
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid() if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
&& Utilities.isSurroundedByWater(player) && Utilities.isSurroundedByWater(player)
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0) && ((movementManager.motionY == 0 && movementManager.lastMotionY == 0)
@@ -66,7 +67,7 @@ public class WaterWalkCheck {
double minAbsMotionY = 0.12D; double minAbsMotionY = 0.12D;
if (player.hasPotionEffect(PotionEffectType.SPEED)) 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() if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid()
&& Utilities.isSurroundedByWater(player) && Utilities.isSurroundedByWater(player)
&& Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY && Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY
@@ -458,7 +458,8 @@ public class User {
} }
public boolean isLagging() { 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() { public MovementManager getMovementManager() {
@@ -48,7 +48,6 @@ public final class Utilities {
public static final Material LILY_PAD; public static final Material LILY_PAD;
public static final Material COB_WEB; public static final Material COB_WEB;
public static final Material IRON_BARS;
public static final double JUMP_MOTION_Y = 0.41999998688697815; public static final double JUMP_MOTION_Y = 0.41999998688697815;
@@ -227,10 +226,12 @@ public final class Utilities {
} }
public static boolean isHalfblock(Block block) { public static boolean isHalfblock(Block block) {
BoundingBox box = block.getBoundingBox(); if (!VersionUtil.isBountifulUpdate()) {
double height = box.getMaxY() - box.getMinY(); BoundingBox box = block.getBoundingBox();
if (height > 0.42 && height <= 0.6 && block.getType().isSolid()) double height = box.getMaxY() - box.getMinY();
return true; 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;
} }
@@ -412,7 +413,7 @@ public final class Utilities {
*/ */
public static boolean isWall(Block block) { public static boolean isWall(Block block) {
Material type = block.getType(); Material type = block.getType();
return type.name().endsWith("WALL"); return type.name().endsWith("WALL") || type.name().endsWith("FENCE");
} }
/** /**
@@ -536,6 +537,22 @@ public final class Utilities {
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.WEST)); || 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 * Determine whether a block is climbable
* *
@@ -748,7 +765,6 @@ public final class Utilities {
if (VersionUtil.isBountifulUpdate()) { if (VersionUtil.isBountifulUpdate()) {
LILY_PAD = XMaterial.LILY_PAD.parseMaterial(); LILY_PAD = XMaterial.LILY_PAD.parseMaterial();
COB_WEB = XMaterial.COBWEB.parseMaterial(); COB_WEB = XMaterial.COBWEB.parseMaterial();
IRON_BARS = XMaterial.IRON_BARS.parseMaterial();
// Start instant break materials // Start instant break materials
INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial()); INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial());
@@ -832,7 +848,6 @@ public final class Utilities {
else { else {
LILY_PAD = Material.LILY_PAD; LILY_PAD = Material.LILY_PAD;
COB_WEB = Material.COBWEB; COB_WEB = Material.COBWEB;
IRON_BARS = Material.IRON_BARS;
// Start instant break materials // Start instant break materials
INSTANT_BREAK.add(Material.COMPARATOR); INSTANT_BREAK.add(Material.COMPARATOR);
@@ -971,7 +986,8 @@ public final class Utilities {
CLIMBABLE.add(Material.LADDER); CLIMBABLE.add(Material.LADDER);
CLIMBABLE.add(Material.WATER); CLIMBABLE.add(Material.WATER);
// Start 1.14 objects // 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); CLIMBABLE.add(Material.SCAFFOLDING);
} }
// End 1.14 objects // End 1.14 objects
@@ -981,7 +997,7 @@ public final class Utilities {
CLIMBABLE.add(XMaterial.TWISTING_VINES.parseMaterial()); CLIMBABLE.add(XMaterial.TWISTING_VINES.parseMaterial());
CLIMBABLE.add(XMaterial.TWISTING_VINES_PLANT.parseMaterial()); CLIMBABLE.add(XMaterial.TWISTING_VINES_PLANT.parseMaterial());
CLIMBABLE.add(XMaterial.WEEPING_VINES.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 1.16 objects
// End climbable // End climbable
@@ -134,4 +134,24 @@ public class VersionUtil {
return effect.getType().equals(PotionEffectType.LEVITATION); 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();
}
} }