mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Compare commits
5
Commits
1.9.0-PRE1
..
1.9.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9850f48a4e | ||
|
|
656841b046 | ||
|
|
fc006c39f2 | ||
|
|
f4ca2ea8bf | ||
|
|
6966582e4c |
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.9.0-PRE</version>
|
||||
<version>1.9.0</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||
<properties>
|
||||
|
||||
@@ -60,7 +60,7 @@ public class FlightCheck {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
|
||||
if (Utilities.isNearWater(player) || movementManager.halfMovement
|
||||
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)))
|
||||
@@ -115,7 +115,9 @@ public class FlightCheck {
|
||||
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||
&& (!Utilities.isNearBed(distance.getTo())
|
||||
|| (Utilities.isNearBed(distance.getTo()) && movementManager.motionY > 0.12675)))
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
/**
|
||||
* @author Rammelkast
|
||||
* TODO soulsand speed
|
||||
* TODO fix false positive with water weeds
|
||||
*/
|
||||
public class SpeedCheck {
|
||||
|
||||
@@ -113,6 +114,10 @@ public class SpeedCheck {
|
||||
// TODO better way for this
|
||||
if (player.isBlocking() && movementManager.airTicks > 2)
|
||||
predict *= 0.8D;
|
||||
// Fixes false positive when coming out of water
|
||||
if (movementManager.nearLiquidTicks >= 7 && movementManager.airTicks >= 14
|
||||
&& movementManager.motionY < -0.18 && movementManager.motionY > -0.182)
|
||||
predict += Math.abs(movementManager.motionY);
|
||||
|
||||
if (distanceXZ - predict > limit) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "moved too fast in air (speed=" + distanceXZ
|
||||
@@ -171,6 +176,9 @@ public class SpeedCheck {
|
||||
// Slab leniency
|
||||
if (movementManager.halfMovementHistoryCounter > 8)
|
||||
limit += 0.2D;
|
||||
// LivingEntities can give players a small push boost
|
||||
if (!movingTowards.getWorld().getNearbyEntities(movingTowards, 0.3, 0.3, 0.3).isEmpty())
|
||||
limit += 0.2D;
|
||||
// Leniency when boxed in
|
||||
if (boxedIn)
|
||||
limit *= 1.1D;
|
||||
@@ -207,7 +215,7 @@ public class SpeedCheck {
|
||||
limit *= 0.65D;
|
||||
// Sneak speed check
|
||||
// TODO config
|
||||
if (player.isSneaking())
|
||||
if (movementManager.sneakingTicks > 1)
|
||||
limit *= 0.68D;
|
||||
|
||||
if (distanceXZ - limit > 0) {
|
||||
@@ -229,13 +237,16 @@ public class SpeedCheck {
|
||||
|
||||
if (player.isInsideVehicle() || player.isSleeping()
|
||||
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_EXTENSION()) || VersionUtil.isFlying(player)
|
||||
|| VersionUtil.isRiptiding(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);
|
||||
// Fix false positive with soulsand boost
|
||||
if (movementManager.nearLiquidTicks > 6)
|
||||
maxMotionY *= 1.0525D;
|
||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"exceeded vertical speed limit (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||
|
||||
@@ -50,18 +50,18 @@ public class WaterWalkCheck {
|
||||
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
||||
&& Utilities.isSurroundedByWater(player)
|
||||
&& (movementManager.motionY == 0 || movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ"))
|
||||
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0) || movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ"))
|
||||
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, "lunge", "maxMotionY"))
|
||||
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY"))
|
||||
return new CheckResult(Result.FAILED,
|
||||
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
||||
|
||||
double minAbsMotionY = 0.08D;
|
||||
double minAbsMotionY = 0.12D;
|
||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||
minAbsMotionY += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.05D;
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid()
|
||||
|
||||
+29
-24
@@ -19,39 +19,44 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded.command.executors;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandChecks extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheatReloaded Checks Management";
|
||||
private static final String COMMAND = "checks";
|
||||
private static final String USAGE = "anticheat checks";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||
private static final String[] HELP = new String[2];
|
||||
private static final String NAME = "AntiCheatReloaded Checks Management";
|
||||
private static final String COMMAND = "checks";
|
||||
private static final String USAGE = "anticheat checks";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||
private static final String[] HELP = new String[2];
|
||||
|
||||
static {
|
||||
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat checks" + GRAY + " for a list of checks";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(GRAY + "Checks: ");
|
||||
for (int i=0;i<CheckType.values().length;i++) {
|
||||
builder.append(CheckType.values()[i]);
|
||||
if (i<CheckType.values().length-1) {
|
||||
builder.append(", ");
|
||||
}
|
||||
}
|
||||
HELP[1] = builder.toString();
|
||||
}
|
||||
static {
|
||||
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat checks" + GRAY + " for a list of checks";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
CheckManager checkManager = AntiCheatReloaded.getManager().getCheckManager();
|
||||
builder.append(GRAY + "Checks: ");
|
||||
for (int i = 0; i < CheckType.values().length; i++) {
|
||||
CheckType type = CheckType.values()[i];
|
||||
builder.append((checkManager.isActive(type) ? ChatColor.GREEN : ChatColor.RED) + type.getName());
|
||||
if (i < CheckType.values().length - 1) {
|
||||
builder.append(", ");
|
||||
}
|
||||
}
|
||||
HELP[1] = builder.toString();
|
||||
}
|
||||
|
||||
public CommandChecks() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
public CommandChecks() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
sendHelp(cs);
|
||||
}
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded.command.executors;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
@@ -41,6 +42,6 @@ public class CommandReload extends CommandBase {
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
CONFIG.load();
|
||||
cs.sendMessage(GREEN + "AntiCheat configuration reloaded.");
|
||||
cs.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + "The configuration was reloaded");
|
||||
}
|
||||
}
|
||||
@@ -151,12 +151,15 @@ public class Configuration {
|
||||
file.load();
|
||||
checkReload(file);
|
||||
}
|
||||
for (ConfigurationTable table : dbfiles) {
|
||||
|
||||
for (ConfigurationTable table : dbfiles)
|
||||
table.load();
|
||||
}
|
||||
if (manager.getBackend() != null) {
|
||||
|
||||
if (manager.getBackend() != null)
|
||||
manager.getBackend().updateConfig(this);
|
||||
}
|
||||
|
||||
if (manager.getCheckManager() != null)
|
||||
manager.getCheckManager().loadCheckIgnoreList(this);
|
||||
}
|
||||
|
||||
private void checkReload(ConfigurationFile file) {
|
||||
|
||||
@@ -47,11 +47,14 @@ public class CheckManager {
|
||||
public CheckManager(AntiCheatManager manager) {
|
||||
this.manager = manager;
|
||||
this.config = manager.getConfiguration();
|
||||
this.loadCheckIgnoreList(this.config);
|
||||
}
|
||||
|
||||
public void loadCheckIgnoreList(Configuration configuration) {
|
||||
checkIgnoreList.clear();
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (!config.getChecks().isEnabled(type)) {
|
||||
if (!configuration.getChecks().isEnabled(type)) {
|
||||
checkIgnoreList.add(type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +63,7 @@ public class CheckManager {
|
||||
+ checkIgnoreList.size() + " check(s) have been disabled");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Turn a check on
|
||||
*
|
||||
|
||||
@@ -67,6 +67,10 @@ public class MovementManager {
|
||||
public int elytraEffectTicks;
|
||||
// Used by Velocity check, represents the currently expected Y motion
|
||||
public double velocityExpectedMotionY;
|
||||
// Amount of ticks a player is sneaking
|
||||
public int sneakingTicks;
|
||||
// Ticks counter after being near a liquid
|
||||
public int nearLiquidTicks;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void handle(Player player, Location from, Location to, Distance distance) {
|
||||
@@ -121,6 +125,20 @@ public class MovementManager {
|
||||
if (this.elytraEffectTicks > 0)
|
||||
this.elytraEffectTicks--;
|
||||
}
|
||||
|
||||
if (player.isSneaking())
|
||||
this.sneakingTicks++;
|
||||
else
|
||||
this.sneakingTicks = 0;
|
||||
|
||||
if (Utilities.isNearWater(player))
|
||||
this.nearLiquidTicks = 8;
|
||||
else {
|
||||
if (this.nearLiquidTicks > 0)
|
||||
this.nearLiquidTicks--;
|
||||
else
|
||||
this.nearLiquidTicks = 0;
|
||||
}
|
||||
|
||||
double lastDistanceSq = Math.sqrt(this.lastDistance.getXDifference() * this.lastDistance.getXDifference()
|
||||
+ this.lastDistance.getZDifference() * this.lastDistance.getZDifference());
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -237,9 +236,7 @@ public class User {
|
||||
* @return true if the location was valid and set properly
|
||||
*/
|
||||
public boolean setGoodLocation(Location location) {
|
||||
if (Utilities.cantStandAtExp(location)
|
||||
|| (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))
|
||||
|| (!location.getBlock().getType().isSolid() && location.getBlock().getType() != Material.AIR)) {
|
||||
if (Utilities.cantStandAtExp(location)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -424,9 +424,16 @@ public final class Utilities {
|
||||
public static boolean isInWater(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.UP).isLiquid()
|
||||
|| (!VersionUtil.isBountifulUpdate()
|
||||
&& (player.getLocation().getBlock().getType() == XMaterial.KELP_PLANT.parseMaterial()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP)
|
||||
.getType() == XMaterial.KELP_PLANT.parseMaterial()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN)
|
||||
.getType() == XMaterial.KELP_PLANT.parseMaterial())
|
||||
&& isNearWater(player));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a player is near a liquid block
|
||||
*
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# AntiCheatReloaded checks configuration file
|
||||
# Checks that have multiple modules need to be disabled on a per-module basis
|
||||
# If you have a false positive and can't determine what subcheck it's from,
|
||||
# enable debug-mode in config.yml and compare the results against the commented values
|
||||
# Flight check settings
|
||||
# Checks if a player moves wrongly in the air
|
||||
flight:
|
||||
@@ -98,8 +101,6 @@ speed:
|
||||
# WaterWalk check settings
|
||||
# Checks if a player is walking on water
|
||||
waterwalk:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
# Checks for vanilla water walking/jumping
|
||||
# Debugs as 'tried to walk on water'
|
||||
walk:
|
||||
@@ -109,20 +110,20 @@ waterwalk:
|
||||
# This combats false positives, while giving hackers not much leniency
|
||||
minimumDistXZ: 0.092
|
||||
# Checks for small hops on top of water
|
||||
# Debugs as 'tried to lunge on water'
|
||||
# Debugs as 'tried to hop on water'
|
||||
hop:
|
||||
# Should this part of the check be enabled?
|
||||
enabled: true
|
||||
# Maximum lunge Y motion to flag
|
||||
maxMotionY: 0.10
|
||||
# Checks for small lunges in water
|
||||
# Debugs as 'tried to walk on water'
|
||||
# Debugs as 'tried to lunge in water'
|
||||
lunge:
|
||||
# Should this part of the check be enabled?
|
||||
enabled: true
|
||||
# Minimum xz distance before flagging
|
||||
# This combats false positives, while giving hackers not much leniency
|
||||
minimumDistXZ: 0.0642
|
||||
minimumDistXZ: 0.098
|
||||
|
||||
# FastLadder check settings
|
||||
# Checks if a player moves too fast on a ladder
|
||||
|
||||
@@ -35,9 +35,9 @@ system:
|
||||
# Do NOT enable this in a production environment!
|
||||
debug-mode: false
|
||||
# To prevent spamming, staff and the console will only be notified every x violations
|
||||
# Minimum value is 1, default is 10
|
||||
# Minimum value is 1, default is 8
|
||||
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
||||
notify-every-vl: 10
|
||||
notify-every-vl: 8
|
||||
# Use /AntiCheatReloaded checks for a list of valid checks
|
||||
disable-in:
|
||||
- example-world
|
||||
|
||||
Reference in new issue
Block a user