mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Compare commits
10
Commits
1.9.0-PRE1
..
1.9.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bc49141fc | ||
|
|
cffd6d07ae | ||
|
|
e9a99f0463 | ||
|
|
4deb8ae0fb | ||
|
|
07f957cf35 | ||
|
|
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.1</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||
<properties>
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@@ -229,7 +230,8 @@ public class Backend {
|
||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
||||
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
||||
&& !VersionUtil.isSlowFalling(player)) {
|
||||
&& !VersionUtil.isSlowFalling(player) && !Utilities
|
||||
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation())) {
|
||||
if (player.getFallDistance() == 0) {
|
||||
if (nofallViolation.get(uuid) == null) {
|
||||
nofallViolation.put(uuid, 1);
|
||||
|
||||
@@ -49,8 +49,10 @@ public class FlightCheck {
|
||||
|
||||
public static CheckResult runCheck(Player player, Distance distance) {
|
||||
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||
|| VersionUtil.isFlying(player)) {
|
||||
// This was a teleport or user is flying/using elytra, so we don't care
|
||||
|| VersionUtil.isFlying(player) || player.getVehicle() != null
|
||||
|| AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)) {
|
||||
// This was a teleport or user is flying/using elytra/in a vehicle, so we don't
|
||||
// care
|
||||
// about it.
|
||||
return PASS;
|
||||
}
|
||||
@@ -60,7 +62,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)))
|
||||
@@ -90,6 +92,10 @@ public class FlightCheck {
|
||||
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
||||
: (blockPlaceAccountingTime + 1);
|
||||
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
||||
// Fixes snow false positive
|
||||
if (movementManager.motionY < 0.004 && Utilities
|
||||
.isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation()))
|
||||
maxMotionY = 0.004D;
|
||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0)
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||
@@ -105,23 +111,28 @@ public class FlightCheck {
|
||||
// End AirFlight
|
||||
|
||||
// Start AirClimb
|
||||
// TODO two hardcoded values here shouldn't be there, temp against false
|
||||
// TODO three hardcoded values here shouldn't be there, temp against false
|
||||
// positive
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
||||
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
||||
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
||||
&& Math.round(movementManager.motionY * 1000) != 248
|
||||
&& !(Math.round(movementManager.motionY * 1000) == 333
|
||||
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
||||
&& !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 + ")");
|
||||
|
||||
// TODO hardcoded value against false again..
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
||||
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||
&& !(Math.round(movementManager.motionY * 1000) == 425 && movementManager.airTicks == 11)
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
|
||||
@@ -99,7 +99,7 @@ public class SpeedCheck {
|
||||
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0)
|
||||
predict *= 1.25D;
|
||||
// Boats sometimes give a false positive
|
||||
if (Utilities.couldBeOnBoat(player, 0.5))
|
||||
if (Utilities.couldBeOnBoat(player, 0.5, true))
|
||||
predict *= 1.25D;
|
||||
// Strafing in air when nearing terminal velocity gives false positives
|
||||
// This fixes the issue but gives hackers some leniency which means we need another check for this
|
||||
@@ -113,6 +113,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 +175,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 +214,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) {
|
||||
@@ -221,21 +228,21 @@ public class SpeedCheck {
|
||||
|
||||
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (isSpeedExempt(player, backend) || player.getVehicle() != null || player.isSleeping()
|
||||
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player))
|
||||
return PASS;
|
||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||
.getMovementManager();
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
||||
return PASS;
|
||||
|
||||
if (player.isInsideVehicle() || player.isSleeping()
|
||||
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_EXTENSION()) || VersionUtil.isFlying(player)
|
||||
|| VersionUtil.isRiptiding(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 + ")");
|
||||
@@ -249,9 +256,9 @@ public class SpeedCheck {
|
||||
double base = couldBeOnBoat ? 0.600000025 : (nearBed ? 0.5625 : (halfMovement ? 0.6 : 0.42));
|
||||
if (fromClimbable)
|
||||
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||
base += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 0.2D;
|
||||
}
|
||||
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||
base += (player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1) * 0.2D;
|
||||
return base;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class WaterWalkCheck {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||
MovementManager movementManager = user.getMovementManager();
|
||||
|
||||
if (movementManager.distanceXZ <= 0)
|
||||
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null)
|
||||
return PASS;
|
||||
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
@@ -50,18 +50,21 @@ 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")
|
||||
&& !movementManager.topSolid && !Utilities.couldBeOnBoat(player, 3, false))
|
||||
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")
|
||||
&& !Utilities.couldBeOnBoat(player, 0.3, false))
|
||||
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) {
|
||||
|
||||
@@ -51,6 +51,7 @@ public class Config extends ConfigurationFile {
|
||||
public ConfigValue<List<String>> disabledWorlds;
|
||||
|
||||
public ConfigValue<Integer> notifyEveryVl;
|
||||
public ConfigValue<Integer> maxSetbackDistance;
|
||||
|
||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
@@ -85,5 +86,10 @@ public class Config extends ConfigurationFile {
|
||||
if (notifyEveryVl.getValue() < 1) {
|
||||
notifyEveryVl.setValue(5);
|
||||
}
|
||||
|
||||
maxSetbackDistance = new ConfigValue<Integer>("system.max-setback-distance");
|
||||
if (maxSetbackDistance.getValue() < 5) {
|
||||
maxSetbackDistance.setValue(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
@@ -134,29 +135,28 @@ public class EntityListener extends EventListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.getDamager() instanceof Player) {
|
||||
Player player = (Player) e.getDamager();
|
||||
getBackend().logDamage(player, 1);
|
||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (noHack) {
|
||||
decrease(player);
|
||||
}
|
||||
}
|
||||
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
|
||||
Player player = (Player) e.getDamager();
|
||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (noHack) {
|
||||
decrease(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@@ -256,9 +257,6 @@ public class PlayerListener extends EventListener {
|
||||
@EventHandler
|
||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!event.isSprinting()) {
|
||||
getBackend().logEnterExit(player);
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
||||
CheckResult result = getBackend().checkSprintHungry(event);
|
||||
if (result.failed()) {
|
||||
@@ -436,7 +434,6 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
boolean changed = false;
|
||||
if (event.getTo() != event.getFrom()) {
|
||||
double x = distance.getXDifference();
|
||||
double z = distance.getZDifference();
|
||||
@@ -449,7 +446,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPEED);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
||||
@@ -458,7 +454,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPEED);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
||||
@@ -469,7 +464,6 @@ public class PlayerListener extends EventListener {
|
||||
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.WATER_WALK);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
||||
@@ -479,7 +473,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPIDER);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||
@@ -491,12 +484,8 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (!changed) {
|
||||
user.setGoodLocation(event.getFrom());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -21,6 +21,8 @@ package com.rammelkast.anticheatreloaded.util;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
public class MovementManager {
|
||||
|
||||
// Ticks in air
|
||||
@@ -67,6 +69,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) {
|
||||
@@ -74,16 +80,16 @@ public class MovementManager {
|
||||
// This is checked for spoofing by "GroundFlight"
|
||||
// Also seems to make NoFall cheats flag for speed lmao
|
||||
this.onGround = player.isOnGround();
|
||||
|
||||
|
||||
double x = distance.getXDifference();
|
||||
double z = distance.getZDifference();
|
||||
this.lastDistanceXZ = this.distanceXZ;
|
||||
double z = distance.getZDifference();
|
||||
this.lastDistanceXZ = this.distanceXZ;
|
||||
this.distanceXZ = Math.sqrt(x * x + z * z);
|
||||
|
||||
|
||||
// Account for standing on boat
|
||||
if (Utilities.couldBeOnBoat(player, 0.25))
|
||||
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
|
||||
this.onGround = true;
|
||||
|
||||
|
||||
this.touchedGroundThisTick = false;
|
||||
this.halfMovement = false;
|
||||
if (!this.onGround) {
|
||||
@@ -96,7 +102,7 @@ public class MovementManager {
|
||||
this.airTicks = 0;
|
||||
this.groundTicks++;
|
||||
}
|
||||
|
||||
|
||||
if (Utilities.couldBeOnIce(to)) {
|
||||
this.iceTicks++;
|
||||
this.iceInfluenceTicks = 60;
|
||||
@@ -105,7 +111,7 @@ public class MovementManager {
|
||||
if (this.iceInfluenceTicks > 0)
|
||||
this.iceInfluenceTicks--;
|
||||
}
|
||||
|
||||
|
||||
if (Utilities.couldBeOnSlime(to)) {
|
||||
this.slimeTicks++;
|
||||
this.slimeInfluenceTicks = 40;
|
||||
@@ -114,34 +120,52 @@ public class MovementManager {
|
||||
if (this.slimeInfluenceTicks > 0)
|
||||
this.slimeInfluenceTicks--;
|
||||
}
|
||||
|
||||
|
||||
if (VersionUtil.isGliding(player)) {
|
||||
this.elytraEffectTicks = 30;
|
||||
} else {
|
||||
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());
|
||||
double currentDistanceSq = Math.sqrt(distance.getXDifference() * distance.getXDifference()
|
||||
+ distance.getZDifference() * distance.getZDifference());
|
||||
this.acceleration = currentDistanceSq - lastDistanceSq;
|
||||
|
||||
|
||||
this.lastMotionY = this.motionY;
|
||||
this.motionY = to.getY() - from.getY();
|
||||
|
||||
|
||||
Location top = to.clone().add(0, 2, 0);
|
||||
this.topSolid = top.getBlock().getType().isSolid();
|
||||
Location bottom = to.clone().add(0, -1, 0);
|
||||
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
||||
|
||||
if ((this.motionY > 0.464D && this.motionY <= 0.5625D) && (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
||||
|
||||
if ((this.motionY > 0.42D && this.motionY <= 0.5625D)
|
||||
&& (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
||||
this.halfMovement = true;
|
||||
this.halfMovementHistoryCounter = 30;
|
||||
} else {
|
||||
if (this.halfMovementHistoryCounter > 0)
|
||||
this.halfMovementHistoryCounter--;
|
||||
}
|
||||
|
||||
// Update "good location"
|
||||
AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).setGoodLocation(from);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -218,7 +217,8 @@ public class User {
|
||||
* @return last known valid location
|
||||
*/
|
||||
public Location getGoodLocation(Location location) {
|
||||
if (goodLocation == null) {
|
||||
if (goodLocation == null || !location.getWorld().equals(goodLocation.getWorld())
|
||||
|| location.distance(goodLocation) > config.getConfig().maxSetbackDistance.getValue()) {
|
||||
return location;
|
||||
}
|
||||
|
||||
@@ -237,9 +237,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,17 +124,22 @@ public final class Utilities {
|
||||
}
|
||||
|
||||
public static boolean couldBeOnBoat(Player player) {
|
||||
return couldBeOnBoat(player, 0.35);
|
||||
return couldBeOnBoat(player, 0.35, false);
|
||||
}
|
||||
|
||||
public static boolean couldBeOnBoat(Player player, double range) {
|
||||
public static boolean couldBeOnBoat(Player player, double range, boolean checkY) {
|
||||
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
||||
if (entity instanceof Boat)
|
||||
return true;
|
||||
if (entity instanceof Boat) {
|
||||
if (((Boat) entity).getLocation().getY() < player.getLocation().getY() + 0.25) {
|
||||
return true;
|
||||
} else if (!checkY) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a player could be standing on ice
|
||||
*
|
||||
@@ -171,6 +176,31 @@ public final class Utilities {
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a block is a shulker box
|
||||
*
|
||||
* @param block block to check
|
||||
* @return true if block is a shulker box
|
||||
*/
|
||||
public static boolean isShulkerBox(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("SHULKER_BOX");
|
||||
}
|
||||
|
||||
public static boolean isNearShulkerBox(Location location) {
|
||||
if (VersionUtil.isBountifulUpdate())
|
||||
return false;
|
||||
return isShulkerBox(location.getBlock())
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.EAST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.WEST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player could be standing on a halfblock
|
||||
*
|
||||
@@ -196,7 +226,7 @@ public final class Utilities {
|
||||
}
|
||||
|
||||
public static boolean isHalfblock(Block block) {
|
||||
return isSlab(block) || isStair(block) || isWall(block);
|
||||
return isSlab(block) || isStair(block) || isWall(block) || block.getType() == Material.SNOW;
|
||||
}
|
||||
|
||||
|
||||
@@ -424,9 +454,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
|
||||
@@ -191,7 +192,7 @@ velocity:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
# Minimum percentage of the given knockback a player has to meet
|
||||
minimumPercentage: 98
|
||||
minimumPercentage: 75
|
||||
# Amount of low-velocity moments before flagging
|
||||
vlBeforeFlag: 2
|
||||
|
||||
|
||||
@@ -35,10 +35,14 @@ 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
|
||||
# Use /AntiCheatReloaded checks for a list of valid checks
|
||||
notify-every-vl: 8
|
||||
# Maximum distance a player can be set back
|
||||
# If the last known valid location is further away than this,
|
||||
# the player will be rubberbanded at their current location
|
||||
# Minimum value is 5, default is 50
|
||||
max-setback-distance: 50
|
||||
disable-in:
|
||||
- example-world
|
||||
- example-world-2
|
||||
@@ -1,9 +1,9 @@
|
||||
# Time to exempt a player from moving because of entering/exiting a vehicle
|
||||
# Increase in case of false positives
|
||||
ENTERED_EXITED_TIME: 1000
|
||||
ENTERED_EXITED_TIME: 250
|
||||
# Time to exempt a player from moving because of teleporting
|
||||
# Increase in case of false positives
|
||||
TELEPORT_TIME: 1000
|
||||
TELEPORT_TIME: 1500
|
||||
# Time to exempt a player from moving because of exiting fly mode
|
||||
# Changing this value is almost never required
|
||||
EXIT_FLY_TIME: 2000
|
||||
@@ -26,9 +26,9 @@ EXPLOSION_DAMAGE_TIME: 5000
|
||||
# Amount of seconds to extend a players velocitized state after receiving velocity again
|
||||
VELOCITY_EXTENSION: 2
|
||||
# Time a player is considered to have a change in velocity
|
||||
VELOCITY_TIME: 2000
|
||||
VELOCITY_TIME: 1000
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_PREVENT: 5000
|
||||
VELOCITY_PREVENT: 2000
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_MAXTIMES: 2
|
||||
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
||||
|
||||
Reference in new issue
Block a user