From 6fabd7343290f6cee7232c17adb8745b2756dfee Mon Sep 17 00:00:00 2001 From: Rammelkast Date: Wed, 22 Dec 2021 20:17:22 +0100 Subject: [PATCH] Fix fence false positive with vertical Speed, fixed console nag about floodgate depend --- .../check/movement/SpeedCheck.java | 4 +-- .../anticheatreloaded/util/Utilities.java | 25 ++++++++++--------- src/main/resources/plugin.yml | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/SpeedCheck.java b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/SpeedCheck.java index 0d948fa..7d7fe21 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/SpeedCheck.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/SpeedCheck.java @@ -380,7 +380,7 @@ public final class SpeedCheck { Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock()) || Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), - movementManager.halfMovement, checksConfig); + (movementManager.halfMovement || Utilities.isNearWall(distance.getFrom())), checksConfig); // Fix false positive with soulsand boost if (movementManager.nearLiquidTicks > 6) { maxMotionY *= 1.0525D; @@ -407,7 +407,7 @@ public final class SpeedCheck { // 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.6f : (nearBed ? 0.5625f : ((halfMovement) ? 0.6f : 0.42f)); if (fromClimbable) { base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04 } diff --git a/src/main/java/com/rammelkast/anticheatreloaded/util/Utilities.java b/src/main/java/com/rammelkast/anticheatreloaded/util/Utilities.java index 0870449..d4b73f5 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/util/Utilities.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/util/Utilities.java @@ -210,7 +210,7 @@ public final class Utilities { return true; } } - return isSlab(block) || isStair(block) || isWall(block) || block.getType() == Material.SNOW + return isSlab(block) || isStair(block) || isWall(block) || block.getType() == XMaterial.SNOW.parseMaterial() || block.getType().name().endsWith("HEAD"); } @@ -357,7 +357,7 @@ public final class Utilities { * @param block block to check * @return true if stair */ - public static boolean isStair(Block block) { + public static boolean isStair(final Block block) { Material type = block.getType(); return type.name().endsWith("STAIRS"); } @@ -368,19 +368,20 @@ public final class Utilities { * @param block block to check * @return true if wall */ - public static boolean isWall(Block block) { + public static boolean isWall(final Block block) { Material type = block.getType(); return type.name().endsWith("WALL") || type.name().endsWith("FENCE"); } - - /** - * Determine whether a player is sprinting or flying - * - * @param player player to check - * @return true if sprinting or flying - */ - public static boolean sprintFly(Player player) { - return player.isSprinting() || player.isFlying(); + + public static boolean isNearWall(final Location location) { + return isWall(location.getBlock()) || isWall(location.getBlock().getRelative(BlockFace.NORTH)) + || isWall(location.getBlock().getRelative(BlockFace.SOUTH)) + || isWall(location.getBlock().getRelative(BlockFace.EAST)) + || isWall(location.getBlock().getRelative(BlockFace.WEST)) + || isWall(location.getBlock().getRelative(BlockFace.NORTH_EAST)) + || isWall(location.getBlock().getRelative(BlockFace.NORTH_WEST)) + || isWall(location.getBlock().getRelative(BlockFace.SOUTH_EAST)) + || isWall(location.getBlock().getRelative(BlockFace.SOUTH_WEST)); } /** diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5b1f5fb..b7f56ab 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ description: AntiCheatReloaded helps easily identify and block malicious players main: com.rammelkast.anticheatreloaded.AntiCheatReloaded api-version: 1.13 depend: [ProtocolLib] -softdepend: [Floodgate] +softdepend: [Floodgate, floodgate] startup: postworld version: ${project.build.version} commands: