Fixed bug in version check, fixed water-related false positive and fixed wrong permission

This commit is contained in:
Rammelkast committed 2020-05-13 15:56:07 +02:00
1 parent c6e4ce091a
commit 918549bc11
6 files changed
+27 -6

No files matched your search

@@ -276,7 +276,7 @@ public class Backend {
public CheckResult checkNoFall(Player player, double y) {
UUID uuid = player.getUniqueId();
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isInWater(player)
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
&& !VersionUtil.isSlowFalling(player)) {
if (player.getFallDistance() == 0) {
@@ -93,7 +93,7 @@ public class FlightCheck {
string = " with jump potion";
}
Block block = player.getLocation().getBlock();
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player)
if (!isMovingExempt(player) && !Utilities.isNearWater(player) && !VersionUtil.isFlying(player)
&& !backend.justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
@@ -32,8 +32,8 @@ public class CommandMute extends CommandBase {
private static final String NAME = "AntiCheatReloaded Mute";
private static final String COMMAND = "mute";
private static final String USAGE = "anticheat reload";
private static final Permission PERMISSION = Permission.SYSTEM_RELOAD;
private static final String USAGE = "anticheat mute";
private static final Permission PERMISSION = Permission.SYSTEM_MUTE;
private static final String[] HELP = {
GRAY + "Use: " + AQUA + "/anticheat mute" + GRAY + " to mute all notifications", };
@@ -29,8 +29,7 @@ public enum Permission {
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGAL_INTERACT, CHECK_FASTLADDER, CHECK_AIMBOT,
/* System Nodes */
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD;
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD, SYSTEM_MUTE;
private static final String PERMISSION_ALL = "anticheat.*";
private static final String PERMISSION_SPAM = "anticheat.check.spam";
@@ -102,6 +102,8 @@ public class UpdateManager {
public VersionSplit(String version) throws Exception {
if (version.endsWith("-ALPHA")) {
version = version.substring(0, version.length() - 6);
} else if (version.endsWith("-PRE")) {
version = version.substring(0, version.length() - 4);
}
String[] versionSplit = version.split("\\.");
@@ -300,6 +300,26 @@ public final class Utilities {
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
}
/**
* Determine whether a player is near a liquid block
*
* @param player player to check
* @return true if near liquid block
*/
public static boolean isNearWater(Player player) {
return player.getLocation().getBlock().isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.EAST).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.WEST).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH_EAST).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH_WEST).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_EAST).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
}
/**
* Determine whether a player is in a web