mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Fix 1.8.8 support, fix false positive with scaffolding
This commit is contained in:
1 parent
a59a4baf28
commit
e770d0e01c
5 files changed
+28
-12
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.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>
|
||||||
|
|||||||
@@ -92,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 + ")");
|
||||||
|
|
||||||
@@ -133,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
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ 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
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
@@ -414,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");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -538,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
|
||||||
*
|
*
|
||||||
@@ -750,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());
|
||||||
@@ -834,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);
|
||||||
|
|||||||
@@ -136,14 +136,15 @@ public class VersionUtil {
|
|||||||
|
|
||||||
public static int getPotionLevel(Player player, PotionEffectType type) {
|
public static int getPotionLevel(Player player, PotionEffectType type) {
|
||||||
if (isBountifulUpdate()) {
|
if (isBountifulUpdate()) {
|
||||||
for (PotionEffect effect : player.getActivePotionEffects())
|
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||||
if (effect.getType() == type)
|
if (effect.getType().equals(type))
|
||||||
return effect.getAmplifier() + 1;
|
return effect.getAmplifier() + 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
if (player.hasPotionEffect(type))
|
||||||
return player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1;
|
return player.getPotionEffect(type).getAmplifier() + 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user