mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Glide -> Gravity, more migration towards new config, expanded illegalinteract, fix false positives
This commit is contained in:
1 parent
2086a01f80
commit
ad618ffaf0
20 files changed
+291
-349
No files matched your search
@@ -42,10 +42,10 @@ import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
|||||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||||
@@ -91,12 +91,14 @@ public class Backend {
|
|||||||
private Map<UUID, Long> lastSneak = new HashMap<UUID, Long>();
|
private Map<UUID, Long> lastSneak = new HashMap<UUID, Long>();
|
||||||
|
|
||||||
private Magic magic;
|
private Magic magic;
|
||||||
|
private Checks checksConfig;
|
||||||
private AntiCheatManager manager = null;
|
private AntiCheatManager manager = null;
|
||||||
private Lang lang = null;
|
private Lang lang = null;
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public Backend(AntiCheatManager instance) {
|
public Backend(AntiCheatManager instance) {
|
||||||
magic = instance.getConfiguration().getMagic();
|
magic = instance.getConfiguration().getMagic();
|
||||||
|
checksConfig = instance.getConfiguration().getChecks();
|
||||||
manager = instance;
|
manager = instance;
|
||||||
lang = manager.getConfiguration().getLang();
|
lang = manager.getConfiguration().getLang();
|
||||||
transparent.add((byte) -1);
|
transparent.add((byte) -1);
|
||||||
@@ -162,9 +164,6 @@ public class Backend {
|
|||||||
MorePacketsCheck.LAST_PACKET_TIME.remove(uuid);
|
MorePacketsCheck.LAST_PACKET_TIME.remove(uuid);
|
||||||
MorePacketsCheck.PACKET_BALANCE.remove(uuid);
|
MorePacketsCheck.PACKET_BALANCE.remove(uuid);
|
||||||
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
||||||
GlideCheck.LAST_MOTION_Y.remove(uuid);
|
|
||||||
GlideCheck.LAST_FALL_DISTANCE.remove(uuid);
|
|
||||||
GlideCheck.VIOLATIONS.remove(uuid);
|
|
||||||
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
|
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
|
||||||
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
|
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
|
||||||
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
||||||
@@ -225,25 +224,7 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkLongReachBlock(Player player, double x, double y, double z) {
|
|
||||||
if (isInstantBreakExempt(player)) {
|
|
||||||
return new CheckResult(CheckResult.Result.PASSED);
|
|
||||||
} else {
|
|
||||||
String string = "reached too far for a block";
|
|
||||||
double distance = player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
|
||||||
: player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
|
||||||
: magic.BLOCK_MAX_DISTANCE();
|
|
||||||
double i = x >= distance ? x : y > distance ? y : z > distance ? z : -1;
|
|
||||||
if (i != -1) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
string + " (distance=" + i + ", max=" + magic.BLOCK_MAX_DISTANCE() + ")");
|
|
||||||
} else {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkSpider(Player player, double y) {
|
public CheckResult checkSpider(Player player, double y) {
|
||||||
if (y <= magic.LADDER_Y_MAX() && y >= magic.LADDER_Y_MIN()
|
if (y <= magic.LADDER_Y_MAX() && y >= magic.LADDER_Y_MIN()
|
||||||
&& !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
&& !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
@@ -270,10 +251,11 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i = nofallViolation.get(uuid);
|
int i = nofallViolation.get(uuid);
|
||||||
if (i >= magic.NOFALL_LIMIT()) {
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.NOFALL, "vlBeforeFlag");
|
||||||
|
if (i >= vlBeforeFlag) {
|
||||||
nofallViolation.put(player.getUniqueId(), 1);
|
nofallViolation.put(player.getUniqueId(), 1);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to avoid fall damage (fall distance = 0 "
|
return new CheckResult(CheckResult.Result.FAILED, "tried to avoid fall damage (fall distance = 0 "
|
||||||
+ i + " times in a row, max=" + magic.NOFALL_LIMIT() + ")");
|
+ i + " times in a row, max=" + vlBeforeFlag + ")");
|
||||||
} else {
|
} else {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
@@ -287,15 +269,17 @@ public class Backend {
|
|||||||
|
|
||||||
public CheckResult checkSneak(Player player, Location location, double x, double z) {
|
public CheckResult checkSneak(Player player, Location location, double x, double z) {
|
||||||
if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle()
|
if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle()
|
||||||
&& !Utilities.cantStandAtExp(location) && !Utilities.isSlab(location.getBlock().getRelative(BlockFace.DOWN))) {
|
&& !Utilities.cantStandAtExp(location)
|
||||||
double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1;
|
&& !Utilities.isSlab(location.getBlock().getRelative(BlockFace.DOWN))) {
|
||||||
|
double xzMaxSneaking = checksConfig.getDouble(CheckType.SNEAK, "xzMaxSneaking");
|
||||||
|
double i = x > xzMaxSneaking ? x : z > xzMaxSneaking ? z : -1;
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
if (this.fastSneakViolations.containsKey(player.getUniqueId())) {
|
if (this.fastSneakViolations.containsKey(player.getUniqueId())) {
|
||||||
int flags = this.fastSneakViolations.get(player.getUniqueId());
|
int flags = this.fastSneakViolations.get(player.getUniqueId());
|
||||||
if (flags >= 3) { // TODO possible config
|
if (flags >= checksConfig.getInteger(CheckType.SNEAK, "vlBeforeFlag")) {
|
||||||
this.fastSneakViolations.put(player.getUniqueId(), flags - 1);
|
this.fastSneakViolations.put(player.getUniqueId(), flags - 1);
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
|
"was sneaking too fast (speed=" + i + ", max=" + xzMaxSneaking + ")");
|
||||||
}
|
}
|
||||||
this.fastSneakViolations.put(player.getUniqueId(), flags + 1);
|
this.fastSneakViolations.put(player.getUniqueId(), flags + 1);
|
||||||
return PASS;
|
return PASS;
|
||||||
@@ -317,8 +301,8 @@ public class Backend {
|
|||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
final long lastSneak = this.lastSneak.getOrDefault(player.getUniqueId(), (long) 0);
|
final long lastSneak = this.lastSneak.getOrDefault(player.getUniqueId(), (long) 0);
|
||||||
this.lastSneak.put(player.getUniqueId(), System.currentTimeMillis());
|
this.lastSneak.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
if (System.currentTimeMillis() - lastSneak < 75 && (AntiCheatReloaded.getPlugin().getTPS() > 12
|
if (System.currentTimeMillis() - lastSneak < 75
|
||||||
&& !user.isLagging())) {
|
&& (AntiCheatReloaded.getPlugin().getTPS() > 12 && !user.isLagging())) {
|
||||||
if (!this.silentMode()) {
|
if (!this.silentMode()) {
|
||||||
player.teleport(user.getGoodLocation(player.getLocation()));
|
player.teleport(user.getGoodLocation(player.getLocation()));
|
||||||
}
|
}
|
||||||
@@ -475,13 +459,14 @@ public class Backend {
|
|||||||
long last = lastBlockPlaced.get(uuid);
|
long last = lastBlockPlaced.get(uuid);
|
||||||
long lastTime = lastBlockPlaceTime.get(uuid);
|
long lastTime = lastBlockPlaceTime.get(uuid);
|
||||||
long thisTime = time - last;
|
long thisTime = time - last;
|
||||||
|
int minimumTime = checksConfig.getInteger(CheckType.FAST_PLACE, "minimumTime");
|
||||||
|
|
||||||
if (lastTime != 0 && thisTime < magic.FASTPLACE_TIMEMIN()) {
|
if (lastTime != 0 && thisTime < minimumTime) {
|
||||||
lastBlockPlaceTime.put(uuid, (time - last));
|
lastBlockPlaceTime.put(uuid, (time - last));
|
||||||
lastBlockPlaced.put(uuid, time);
|
lastBlockPlaced.put(uuid, time);
|
||||||
fastPlaceViolation.put(uuid, fastPlaceViolation.get(uuid) + 1);
|
fastPlaceViolation.put(uuid, fastPlaceViolation.get(uuid) + 1);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to place a block " + thisTime
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
+ " ms after the last one (min=" + magic.FASTPLACE_TIMEMIN() + " ms)");
|
"tried to place a block " + thisTime + " ms after the last one (min=" + minimumTime + " ms)");
|
||||||
}
|
}
|
||||||
lastBlockPlaceTime.put(uuid, (time - last));
|
lastBlockPlaceTime.put(uuid, (time - last));
|
||||||
}
|
}
|
||||||
@@ -630,16 +615,19 @@ public class Backend {
|
|||||||
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||||
{
|
{
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (tps < 17.5
|
if (tps < checksConfig.getDouble(CheckType.FAST_HEAL, "minimumTps")
|
||||||
|| user.isLagging()) {
|
|| (user.isLagging() && checksConfig.getBoolean(CheckType.FAST_HEAL, "disableForLagging"))) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
long healTime = magic.MIN_HEAL_TIME() - (tps >= 18.5 ? 0 : 50);
|
long minHealTime = checksConfig.getInteger(CheckType.FAST_HEAL, "minHealTime");
|
||||||
long l = lastHeal.get(player.getUniqueId());
|
long lastHealTime = lastHeal.get(player.getUniqueId());
|
||||||
|
int ping = user.getPing();
|
||||||
|
double pingCompensation = checksConfig.getInteger(CheckType.FAST_HEAL, "pingCompensation");
|
||||||
|
long allowedHealTime = (long) (minHealTime - (ping * pingCompensation));
|
||||||
lastHeal.remove(player.getUniqueId());
|
lastHeal.remove(player.getUniqueId());
|
||||||
if ((System.currentTimeMillis() - l) < healTime) {
|
if ((System.currentTimeMillis() - lastHealTime) < allowedHealTime) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "healed too quickly (time="
|
return new CheckResult(CheckResult.Result.FAILED, "healed too quickly (time="
|
||||||
+ (System.currentTimeMillis() - l) + " ms, min=" + healTime + " ms)");
|
+ (System.currentTimeMillis() - lastHealTime) + " ms, min=" + allowedHealTime + " ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
@@ -649,8 +637,7 @@ public class Backend {
|
|||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
if (startEat.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
if (startEat.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||||
{
|
{
|
||||||
if (AntiCheatReloaded.getPlugin().getTPS() < 17.5
|
if (AntiCheatReloaded.getPlugin().getTPS() < 17.5 || user.isLagging()) {
|
||||||
|| user.isLagging()) {
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
long l = startEat.get(player.getUniqueId());
|
long l = startEat.get(player.getUniqueId());
|
||||||
@@ -690,13 +677,13 @@ public class Backend {
|
|||||||
public void logLevitating(final Player player, final int duration) {
|
public void logLevitating(final Player player, final int duration) {
|
||||||
levitatingEnd.put(player.getUniqueId(), System.currentTimeMillis() + (duration * 1000L));
|
levitatingEnd.put(player.getUniqueId(), System.currentTimeMillis() + (duration * 1000L));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean justVelocity(Player player) {
|
public boolean justVelocity(Player player) {
|
||||||
return (velocitized.containsKey(player.getUniqueId())
|
return (velocitized.containsKey(player.getUniqueId())
|
||||||
? (System.currentTimeMillis() - velocitized.get(player.getUniqueId())) < magic.VELOCITY_CHECKTIME()
|
? (System.currentTimeMillis() - velocitized.get(player.getUniqueId())) < magic.VELOCITY_CHECKTIME()
|
||||||
: false);
|
: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean justLevitated(Player player) {
|
public boolean justLevitated(Player player) {
|
||||||
return (levitatingEnd.containsKey(player.getUniqueId())
|
return (levitatingEnd.containsKey(player.getUniqueId())
|
||||||
? (System.currentTimeMillis() - levitatingEnd.get(player.getUniqueId())) < magic.VELOCITY_CHECKTIME()
|
? (System.currentTimeMillis() - levitatingEnd.get(player.getUniqueId())) < magic.VELOCITY_CHECKTIME()
|
||||||
@@ -758,19 +745,17 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void logTeleport(final Player player) {
|
public void logTeleport(final Player player) {
|
||||||
manager.getUserManager().getUser(player.getUniqueId()).getMovementManager().lastTeleport = System.currentTimeMillis();
|
manager.getUserManager().getUser(player.getUniqueId()).getMovementManager().lastTeleport = System
|
||||||
|
.currentTimeMillis();
|
||||||
/* Data for fly/speed should be reset */
|
/* Data for fly/speed should be reset */
|
||||||
nofallViolation.remove(player.getUniqueId());
|
nofallViolation.remove(player.getUniqueId());
|
||||||
GlideCheck.LAST_FALL_DISTANCE.remove(player.getUniqueId());
|
|
||||||
GlideCheck.LAST_MOTION_Y.remove(player.getUniqueId());
|
|
||||||
GlideCheck.VIOLATIONS.remove(player.getUniqueId());
|
|
||||||
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logExitFly(final Player player) {
|
public void logExitFly(final Player player) {
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.EXIT_FLY_TIME());
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.EXIT_FLY_TIME());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logBoatCollision(final Player player) {
|
public void logBoatCollision(final Player player) {
|
||||||
// TODO config
|
// TODO config
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
|
||||||
|
|||||||
@@ -31,17 +31,17 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
|||||||
|
|
||||||
public class CriticalsCheck {
|
public class CriticalsCheck {
|
||||||
|
|
||||||
public static void doDamageEvent(EntityDamageByEntityEvent e, Player damager) {
|
public static void doDamageEvent(EntityDamageByEntityEvent event, Player damager) {
|
||||||
if (!(e.getDamager() instanceof Player) || e.getCause() != DamageCause.ENTITY_ATTACK)
|
if (!(event.getDamager() instanceof Player) || event.getCause() != DamageCause.ENTITY_ATTACK)
|
||||||
return;
|
return;
|
||||||
Player p = (Player) e.getDamager();
|
Player player = (Player) event.getDamager();
|
||||||
if (isCritical(p)) {
|
if (isCritical(player)) {
|
||||||
if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0)
|
if ((player.getLocation().getY() % 1.0 == 0 || player.getLocation().getY() % 0.5 == 0)
|
||||||
&& p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
&& player.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
||||||
e.setCancelled(true);
|
event.setCancelled(true);
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
||||||
.getMessage(),
|
.getMessage(),
|
||||||
p, CheckType.CRITICALS);
|
player, CheckType.CRITICALS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,10 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class KillAuraCheck {
|
public class KillAuraCheck {
|
||||||
|
|
||||||
@@ -42,32 +45,49 @@ public class KillAuraCheck {
|
|||||||
public static CheckResult checkReach(Player player, Entity target) {
|
public static CheckResult checkReach(Player player, Entity target) {
|
||||||
if (!(target instanceof LivingEntity))
|
if (!(target instanceof LivingEntity))
|
||||||
return PASS;
|
return PASS;
|
||||||
// TODO add configs for everything here
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
double allowedReach = target.getVelocity().length() < 0.08 ? 3.6D : 4.0D;
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "reach"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
double allowedReach = target.getVelocity().length() < 0.08
|
||||||
|
? checksConfig.getDouble(CheckType.KILLAURA, "reach", "baseMaxValue.normal")
|
||||||
|
: checksConfig.getDouble(CheckType.KILLAURA, "reach", "baseMaxValue.velocitized");
|
||||||
// Lag compensation
|
// Lag compensation
|
||||||
allowedReach += user.getPing() * 0.0025D;
|
double lagExtraReach = checksConfig.getDouble(CheckType.KILLAURA, "reach", "lagCompensation.lagExtraReach");
|
||||||
|
double pingCompensation = checksConfig.getDouble(CheckType.KILLAURA, "reach",
|
||||||
|
"lagCompensation.pingCompensation");
|
||||||
|
allowedReach += user.getPing() * pingCompensation;
|
||||||
if (user.isLagging())
|
if (user.isLagging())
|
||||||
allowedReach += 0.2D;
|
allowedReach += lagExtraReach;
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
User targetUser = AntiCheatReloaded.getManager().getUserManager().getUser(target.getUniqueId());
|
User targetUser = AntiCheatReloaded.getManager().getUserManager().getUser(target.getUniqueId());
|
||||||
allowedReach += targetUser.getPing()
|
allowedReach += targetUser.getPing() * pingCompensation;
|
||||||
* 0.0025D;
|
|
||||||
if (targetUser.isLagging())
|
if (targetUser.isLagging())
|
||||||
allowedReach += 0.2D;
|
allowedReach += lagExtraReach;
|
||||||
}
|
}
|
||||||
// Velocity compensation
|
// Velocity compensation
|
||||||
allowedReach += Math.abs(target.getVelocity().length()) * 1.2D;
|
double velocityMultiplier = checksConfig.getDouble(CheckType.KILLAURA, "reach", "velocityMultiplier");
|
||||||
double reachedDistance = ((LivingEntity)target).getLocation().toVector().distance(player.getLocation().toVector());
|
allowedReach += Math.abs(target.getVelocity().length()) * velocityMultiplier;
|
||||||
|
double reachedDistance = ((LivingEntity) target).getLocation().toVector()
|
||||||
|
.distance(player.getLocation().toVector());
|
||||||
if (reachedDistance > allowedReach)
|
if (reachedDistance > allowedReach)
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"reached too far (distance=" + reachedDistance + ", max=" + allowedReach + ")");
|
"reached too far (distance=" + Utilities.roundDouble(reachedDistance, 6) + ", max=" + Utilities.roundDouble(allowedReach, 6) + ")");
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "angle"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
LivingEntity living = (LivingEntity) entity;
|
LivingEntity living = (LivingEntity) entity;
|
||||||
Location eyeLocation = player.getEyeLocation();
|
Location eyeLocation = player.getEyeLocation();
|
||||||
@@ -76,16 +96,16 @@ public class KillAuraCheck {
|
|||||||
double playerYaw = player.getEyeLocation().getYaw();
|
double playerYaw = player.getEyeLocation().getYaw();
|
||||||
|
|
||||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||||
if (Math.round(angleDifference) > AntiCheatReloaded.getManager().getConfiguration().getMagic()
|
int maxDifference = checksConfig.getInteger(CheckType.KILLAURA, "angle", "maxDifference");
|
||||||
.KILLAURA_MAX_ANGLE_DIFFERENCE()) {
|
if (Math.round(angleDifference) > maxDifference) {
|
||||||
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
||||||
ANGLE_FLAGS.put(uuid, 1);
|
ANGLE_FLAGS.put(uuid, 1);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int flags = ANGLE_FLAGS.get(uuid);
|
int flags = ANGLE_FLAGS.get(uuid);
|
||||||
if (flags >= AntiCheatReloaded.getManager().getConfiguration().getMagic()
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "angle", "vlBeforeFlag");
|
||||||
.KILLAURA_MAX_ANGLE_VIOLATIONS()) {
|
if (flags >= vlBeforeFlag) {
|
||||||
ANGLE_FLAGS.remove(uuid);
|
ANGLE_FLAGS.remove(uuid);
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
"tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO improve
|
* TODO recode
|
||||||
*/
|
*/
|
||||||
public class VelocityCheck {
|
public class VelocityCheck {
|
||||||
|
|
||||||
@@ -43,25 +44,26 @@ public class VelocityCheck {
|
|||||||
public static void runCheck(EntityDamageByEntityEvent e, final Player player) {
|
public static void runCheck(EntityDamageByEntityEvent e, final Player player) {
|
||||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.VELOCITY))
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.VELOCITY))
|
||||||
return;
|
return;
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
final double minVelocitizedDistance = checksConfig.getDouble(CheckType.VELOCITY, "minVelocitizedDistance");
|
||||||
|
final int vlBeforeFlag = checksConfig.getInteger(CheckType.VELOCITY, "vlBeforeFlag");
|
||||||
final Location then = player.getLocation();
|
final Location then = player.getLocation();
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!player.isOnline())
|
if (!player.isOnline())
|
||||||
return;
|
return;
|
||||||
if (then.distance(player.getLocation()) < 0.125) {
|
if (then.distance(player.getLocation()) < minVelocitizedDistance) {
|
||||||
if (!VIOLATIONS.containsKey(player.getUniqueId()))
|
if (!VIOLATIONS.containsKey(player.getUniqueId()))
|
||||||
VIOLATIONS.put(player.getUniqueId(), 1);
|
VIOLATIONS.put(player.getUniqueId(), 1);
|
||||||
else {
|
else {
|
||||||
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
|
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
|
||||||
if (VIOLATIONS.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
if (VIOLATIONS.get(player.getUniqueId()) > vlBeforeFlag) {
|
||||||
.VELOCITY_MAX_FLAGS()) {
|
|
||||||
EventListener.log(
|
EventListener.log(
|
||||||
new CheckResult(CheckResult.Result.FAILED,
|
new CheckResult(CheckResult.Result.FAILED,
|
||||||
"had zero/low velocity " + VIOLATIONS.get(player.getUniqueId()) + " times (max="
|
"had zero/low velocity " + VIOLATIONS.get(player.getUniqueId())
|
||||||
+ AntiCheatReloaded.getManager().getBackend().getMagic()
|
+ " times (max=" + vlBeforeFlag + ", dist="
|
||||||
.VELOCITY_MAX_FLAGS()
|
+ then.distance(player.getLocation()) + ")").getMessage(),
|
||||||
+ ", dist=" + then.distance(player.getLocation()) + ")").getMessage(),
|
|
||||||
player, CheckType.VELOCITY);
|
player, CheckType.VELOCITY);
|
||||||
VIOLATIONS.remove(player.getUniqueId());
|
VIOLATIONS.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -29,6 +28,8 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
|
||||||
public class AimbotCheck {
|
public class AimbotCheck {
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ public class AimbotCheck {
|
|||||||
|
|
||||||
public static CheckResult runCheck(Player player, PlayerMoveEvent event) {
|
public static CheckResult runCheck(Player player, PlayerMoveEvent event) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
if (backend.isMovingExempt(player)) {
|
if (backend.isMovingExempt(player)) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
@@ -57,7 +59,9 @@ public class AimbotCheck {
|
|||||||
LAST_DELTA_YAW.put(uuid, dYaw);
|
LAST_DELTA_YAW.put(uuid, dYaw);
|
||||||
|
|
||||||
float absoluteYawDifference = Math.abs(dYaw - lastDeltaYaw);
|
float absoluteYawDifference = Math.abs(dYaw - lastDeltaYaw);
|
||||||
if (absoluteYawDifference < 1E-8 && dYaw > 30 && dYaw < 355)
|
int minYaw = checksConfig.getInteger(CheckType.AIMBOT, "minYaw");
|
||||||
|
int maxYaw = checksConfig.getInteger(CheckType.AIMBOT, "maxYaw");
|
||||||
|
if (absoluteYawDifference < 1E-8 && minYaw > 30 && dYaw < maxYaw)
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "repeated yaw difference (dYaw=" + dYaw + ")");
|
return new CheckResult(CheckResult.Result.FAILED, "repeated yaw difference (dYaw=" + dYaw + ")");
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ import org.bukkit.entity.Player;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class FastLadderCheck {
|
public class FastLadderCheck {
|
||||||
@@ -37,7 +38,6 @@ public class FastLadderCheck {
|
|||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, double y) {
|
public static CheckResult runCheck(Player player, double y) {
|
||||||
Magic magic = AntiCheatReloaded.getManager().getBackend().getMagic();
|
|
||||||
// Only check if fully on ladder
|
// Only check if fully on ladder
|
||||||
// Liquids are climbable blocks, so we have to add a seperate check
|
// Liquids are climbable blocks, so we have to add a seperate check
|
||||||
if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|
if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
@@ -47,12 +47,14 @@ public class FastLadderCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int vlCount = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
int vlCount = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.FASTLADDER, "vlBeforeFlag");
|
||||||
if (y > 0) {
|
if (y > 0) {
|
||||||
// Check moving up
|
// Check moving up
|
||||||
double max = magic.LADDER_Y_MAX();
|
double max = checksConfig.getDouble(CheckType.FASTLADDER, "speedUpMax");
|
||||||
// Check if going faster than max Y climbing speed
|
// Check if going faster than max Y climbing speed
|
||||||
if (y - max > 0) {
|
if (y - max > 0) {
|
||||||
if (vlCount++ > magic.FASTLADDER_MAX_FLAGS()) {
|
if (vlCount++ > vlBeforeFlag) {
|
||||||
vlCount = 0;
|
vlCount = 0;
|
||||||
return new CheckResult(Result.FAILED,
|
return new CheckResult(Result.FAILED,
|
||||||
"tried to climb up too fast (speed=" + y + ", max=" + max + ")");
|
"tried to climb up too fast (speed=" + y + ", max=" + max + ")");
|
||||||
@@ -63,11 +65,12 @@ public class FastLadderCheck {
|
|||||||
}
|
}
|
||||||
} else if (y < 0) {
|
} else if (y < 0) {
|
||||||
// Check moving down
|
// Check moving down
|
||||||
if (Math.abs(y) > magic.LADDER_DOWN_MAX() + 6E-9) {
|
double max = checksConfig.getDouble(CheckType.FASTLADDER, "speedDownMax");
|
||||||
if (vlCount++ > magic.FASTLADDER_MAX_FLAGS()) {
|
if (Math.abs(y) > max + 6E-9) {
|
||||||
|
if (vlCount++ > vlBeforeFlag) {
|
||||||
vlCount = 0;
|
vlCount = 0;
|
||||||
return new CheckResult(Result.FAILED, "tried to climb down too fast (speed=" + Math.abs(y)
|
return new CheckResult(Result.FAILED, "tried to climb down too fast (speed=" + Math.abs(y)
|
||||||
+ ", max=" + magic.LADDER_DOWN_MAX() + ")");
|
+ ", max=" + max + ")");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (vlCount > 0)
|
if (vlCount > 0)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
@@ -42,8 +43,10 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|||||||
public class FlightCheck {
|
public class FlightCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
|
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
|
||||||
|
public static final Map<UUID, Integer> GRAVITY_VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
private static final double GRAVITY_FRICTION = 0.9800000190734863D;
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||||
|| VersionUtil.isFlying(player)) {
|
|| VersionUtil.isFlying(player)) {
|
||||||
@@ -51,33 +54,37 @@ public class FlightCheck {
|
|||||||
// about it.
|
// about it.
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
MovementManager movementManager = user.getMovementManager();
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
if (Utilities.isNearWater(player) || movementManager.halfMovement
|
if (Utilities.isNearWater(player) || movementManager.halfMovement
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
|| Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.UP)))
|
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.UP)))
|
||||||
return PASS;
|
return PASS;
|
||||||
|
|
||||||
int minAirTicks = 13;
|
int minAirTicks = 13;
|
||||||
if (player.hasPotionEffect(PotionEffectType.JUMP) ) {
|
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
minAirTicks += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 3;
|
minAirTicks += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movementManager.halfMovementHistoryCounter > 25)
|
if (movementManager.halfMovementHistoryCounter > 25)
|
||||||
minAirTicks += 5;
|
minAirTicks += 5;
|
||||||
|
|
||||||
// Start AirFlight
|
// Start AirFlight
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks) {
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
||||||
|
&& !backend.justVelocity(player)) {
|
||||||
// Config default base is 1200ms
|
// Config default base is 1200ms
|
||||||
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
||||||
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight", "accountForBlockPlacement") + (0.25 * (user.getPing() > 1000 ? 1000 : user.getPing())));
|
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
|
"accountForBlockPlacement") + (0.25 * (user.getPing() > 1000 ? 1000 : user.getPing())));
|
||||||
// Config default account is 250ms
|
// Config default account is 250ms
|
||||||
if (AntiCheatReloaded.getPlugin().getTPS() < 18.0)
|
if (AntiCheatReloaded.getPlugin().getTPS() < 18.0)
|
||||||
blockPlaceAccountingTime += checksConfig.getInteger(CheckType.FLIGHT, "airFlight", "accountForTpsDrops");
|
blockPlaceAccountingTime += checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
|
"accountForTpsDrops");
|
||||||
long lastPlacedBlock = AntiCheatReloaded.getManager().getBackend().placedBlock
|
long lastPlacedBlock = AntiCheatReloaded.getManager().getBackend().placedBlock
|
||||||
.containsKey(player.getUniqueId())
|
.containsKey(player.getUniqueId())
|
||||||
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
||||||
@@ -89,33 +96,38 @@ public class FlightCheck {
|
|||||||
|
|
||||||
if (Math.abs(movementManager.motionY - movementManager.lastMotionY) < 0.01
|
if (Math.abs(movementManager.motionY - movementManager.lastMotionY) < 0.01
|
||||||
&& !Utilities.couldBeOnBoat(player)
|
&& !Utilities.couldBeOnBoat(player)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig.getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports"))
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports"))
|
||||||
&& !VersionUtil.isSlowFalling(player))
|
&& !VersionUtil.isSlowFalling(player))
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "had too little Y dropoff (diff="
|
return new CheckResult(CheckResult.Result.FAILED, "had too little Y dropoff (diff="
|
||||||
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
||||||
}
|
}
|
||||||
// End AirFlight
|
// End AirFlight
|
||||||
|
|
||||||
// Start AirClimb
|
// Start AirClimb
|
||||||
// TODO two hardcoded values here shouldn't be there, temp against false positive
|
// TODO two hardcoded values here shouldn't be there, temp against false
|
||||||
|
// positive
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
||||||
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
||||||
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
||||||
&& !(Math.round(movementManager.motionY * 1000) == 333 && Math.round(movementManager.lastMotionY * 1000) != 333)
|
&& !(Math.round(movementManager.motionY * 1000) == 333
|
||||||
|
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
||||||
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||||
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
||||||
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
||||||
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
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "groundFlight") && movementManager.onGround
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "groundFlight") && movementManager.onGround
|
||||||
&& Utilities.cantStandAt(distance.getTo().getBlock().getRelative(BlockFace.DOWN))
|
&& Utilities.cantStandAt(distance.getTo().getBlock().getRelative(BlockFace.DOWN))
|
||||||
@@ -125,7 +137,27 @@ public class FlightCheck {
|
|||||||
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
|
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
|
||||||
}
|
}
|
||||||
// End GroundFlight
|
// End GroundFlight
|
||||||
|
|
||||||
|
// Start Gravity
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "gravity") && !movementManager.onGround
|
||||||
|
&& movementManager.motionY < 0 && !backend.justVelocity(player)
|
||||||
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))) {
|
||||||
|
double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
||||||
|
double offset = Math.abs(gravitatedY - movementManager.motionY);
|
||||||
|
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
||||||
|
if (offset > maxOffset && movementManager.airTicks > 2) {
|
||||||
|
int vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0) + 1;
|
||||||
|
GRAVITY_VIOLATIONS.put(player.getUniqueId(), vl);
|
||||||
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.FLIGHT, "gravity", "vlBeforeFlag");
|
||||||
|
if (vl >= vlBeforeFlag)
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "ignored gravity (offset=" + offset + ", at=" + movementManager.airTicks + ")");
|
||||||
|
} else {
|
||||||
|
GRAVITY_VIOLATIONS.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End Gravity
|
||||||
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|
||||||
|
|
||||||
public class GlideCheck {
|
|
||||||
|
|
||||||
public static final Map<UUID, Double> LAST_MOTION_Y = new HashMap<UUID, Double>();
|
|
||||||
public static final Map<UUID, Float> LAST_FALL_DISTANCE = new HashMap<UUID, Float>();
|
|
||||||
public static final Map<UUID, Integer> AIR_TICKS = new HashMap<UUID, Integer>();
|
|
||||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
|
||||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
|
||||||
|| VersionUtil.isFlying(player) || FlightCheck.isMovingExempt(player)) {
|
|
||||||
VIOLATIONS.put(player.getUniqueId(), 0);
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getLocation().getBlock().getType() == Material.LADDER
|
|
||||||
|| player.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!LAST_MOTION_Y.containsKey(player.getUniqueId())) {
|
|
||||||
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!LAST_FALL_DISTANCE.containsKey(player.getUniqueId())) {
|
|
||||||
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int violations = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
|
||||||
double motionY = distance.getYDifference();
|
|
||||||
float fallDistance = player.getFallDistance();
|
|
||||||
if (motionY == LAST_MOTION_Y.get(player.getUniqueId())
|
|
||||||
&& fallDistance > LAST_FALL_DISTANCE.get(player.getUniqueId())) {
|
|
||||||
if (violations + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
|
||||||
VIOLATIONS.put(player.getUniqueId(), 0);
|
|
||||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
|
||||||
Location prev = player.getLocation().clone();
|
|
||||||
prev.setY(prev.getY() - distanceToFall(prev));
|
|
||||||
player.teleport(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
|
||||||
.getGoodLocation(prev));
|
|
||||||
}
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"had gliding behaviour (amt=" + Utilities.roundDouble(motionY, 5) + ")");
|
|
||||||
} else {
|
|
||||||
VIOLATIONS.put(player.getUniqueId(), violations + 1);
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
|
||||||
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
|
||||||
if (violations > Math.round(AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT() / 2)) {
|
|
||||||
VIOLATIONS.put(player.getUniqueId(), violations - 1);
|
|
||||||
}
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double distanceToFall(Location location) {
|
|
||||||
location = location.clone();
|
|
||||||
double highestY = location.getWorld().getHighestBlockYAt(location) + 1.02D;
|
|
||||||
return location.getY() - highestY;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -67,11 +67,14 @@ public class SpeedCheck {
|
|||||||
if (iceIncrement > 0.18D)
|
if (iceIncrement > 0.18D)
|
||||||
iceIncrement = 0.18D;
|
iceIncrement = 0.18D;
|
||||||
if (boxedIn)
|
if (boxedIn)
|
||||||
iceIncrement += 0.5D;
|
iceIncrement += 0.45D;
|
||||||
if (!Utilities.couldBeOnIce(movingTowards))
|
if (!Utilities.couldBeOnIce(movingTowards))
|
||||||
iceIncrement *= 2.5D;
|
iceIncrement *= 2.5D;
|
||||||
predict += iceIncrement;
|
predict += iceIncrement;
|
||||||
}
|
}
|
||||||
|
// Leniency when boxed in
|
||||||
|
if (boxedIn && movementManager.airTicks < 3)
|
||||||
|
limit *= 1.2D;
|
||||||
// Adjust for slime
|
// Adjust for slime
|
||||||
if (movementManager.slimeInfluenceTicks > 0) {
|
if (movementManager.slimeInfluenceTicks > 0) {
|
||||||
double slimeIncrement = 0.022 * Math.pow(1.0375, movementManager.slimeInfluenceTicks);
|
double slimeIncrement = 0.022 * Math.pow(1.0375, movementManager.slimeInfluenceTicks);
|
||||||
@@ -111,8 +114,8 @@ public class SpeedCheck {
|
|||||||
predict *= 0.8D;
|
predict *= 0.8D;
|
||||||
|
|
||||||
if (distanceXZ - predict > limit) {
|
if (distanceXZ - predict > limit) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED, "moved too fast in air (speed=" + distanceXZ
|
||||||
"moved too fast in air (speed=" + distanceXZ + ", limit=" + predict + ", blocking=" + player.isBlocking() + ")");
|
+ ", limit=" + predict + ", block=" + player.isBlocking() + ", box=" + boxedIn + ", at=" + movementManager.airTicks + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,6 +126,9 @@ public class SpeedCheck {
|
|||||||
&& movementManager.elytraEffectTicks <= 0) {
|
&& movementManager.elytraEffectTicks <= 0) {
|
||||||
double initialAcceleration = movementManager.acceleration;
|
double initialAcceleration = movementManager.acceleration;
|
||||||
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
|
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
|
||||||
|
// Slight increase when boxed in
|
||||||
|
if (boxedIn)
|
||||||
|
limit *= 1.05D;
|
||||||
// Adjust for speed effects
|
// Adjust for speed effects
|
||||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||||
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.0225D;
|
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.0225D;
|
||||||
@@ -164,6 +170,9 @@ public class SpeedCheck {
|
|||||||
// Slab leniency
|
// Slab leniency
|
||||||
if (movementManager.halfMovementHistoryCounter > 8)
|
if (movementManager.halfMovementHistoryCounter > 8)
|
||||||
limit += 0.2D;
|
limit += 0.2D;
|
||||||
|
// Leniency when boxed in
|
||||||
|
if (boxedIn)
|
||||||
|
limit *= 1.1D;
|
||||||
// Adjust for speed effects
|
// Adjust for speed effects
|
||||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||||
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.06D;
|
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.06D;
|
||||||
@@ -206,7 +215,7 @@ public class SpeedCheck {
|
|||||||
return PASS;
|
return PASS;
|
||||||
|
|
||||||
if (player.isInsideVehicle() || player.isSleeping()
|
if (player.isInsideVehicle() || player.isSleeping()
|
||||||
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_TIME()) || VersionUtil.isFlying(player)
|
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_SCHETIME()) || VersionUtil.isFlying(player)
|
||||||
|| VersionUtil.isRiptiding(player)) {
|
|| VersionUtil.isRiptiding(player)) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
@@ -51,8 +52,9 @@ public class BadPacketsCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO more precise checking for this
|
// TODO more precise checking for this
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (user.isLagging() || tps < 18) {
|
if (user.isLagging() || tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +66,7 @@ public class BadPacketsCheck {
|
|||||||
Location previous = player.getLocation();
|
Location previous = player.getLocation();
|
||||||
Location current = new Location(previous.getWorld(), x, y, z, yaw, pitch);
|
Location current = new Location(previous.getWorld(), x, y, z, yaw, pitch);
|
||||||
double distance = previous.distanceSquared(current);
|
double distance = previous.distanceSquared(current);
|
||||||
double maxDistance = backend.getMagic().BADPACKETS_MAX_DISTANCE();
|
double maxDistance = checksConfig.getDouble(CheckType.BADPACKETS, "maxDistance");
|
||||||
boolean hasNewLocation = packet.getBooleans().read(0);
|
boolean hasNewLocation = packet.getBooleans().read(0);
|
||||||
if (distance > maxDistance) {
|
if (distance > maxDistance) {
|
||||||
flag(player, event, "moved too far between packets (distance=" + new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP) + ", max=" + maxDistance + ")");
|
flag(player, event, "moved too far between packets (distance=" + new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP) + ", max=" + maxDistance + ")");
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast
|
||||||
@@ -44,15 +44,19 @@ public class MorePacketsCheck {
|
|||||||
|
|
||||||
public static void runCheck(Player player, PacketEvent event) {
|
public static void runCheck(Player player, PacketEvent event) {
|
||||||
// Confirm if we should even check for MorePackets
|
// Confirm if we should even check for MorePackets
|
||||||
// Upped TPS min to 17.5, need to add lag-based compensation to combat falses
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.MOREPACKETS) || tps < 17.5) {
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.MOREPACKETS)
|
||||||
|
|| tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)) {
|
int maxPing = checksConfig.getInteger(CheckType.MOREPACKETS, "maxPing");
|
||||||
|
boolean disableForLagging = checksConfig.getBoolean(CheckType.MOREPACKETS, "disableForLagging");
|
||||||
|
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)
|
||||||
|
|| (maxPing > 0 && user.getPing() > maxPing) || (disableForLagging && user.isLagging())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long packetTimeNow = System.currentTimeMillis();
|
long packetTimeNow = System.currentTimeMillis();
|
||||||
@@ -92,9 +96,9 @@ public class MorePacketsCheck {
|
|||||||
|
|
||||||
public static void compensate(Player player) {
|
public static void compensate(Player player) {
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
||||||
PACKET_BALANCE.put(uuid, packetBalance - magic.MOREPACKETS_TELEPORT_COMPENSATION());
|
PACKET_BALANCE.put(uuid, packetBalance - checksConfig.getInteger(CheckType.MOREPACKETS, "teleportCompensation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.player;
|
package com.rammelkast.anticheatreloaded.check.player;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@@ -26,11 +25,15 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
@@ -39,10 +42,33 @@ public class IllegalInteract {
|
|||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult performCheck(Player player, Event event) {
|
public static CheckResult performCheck(Player player, Event event) {
|
||||||
if (event instanceof BlockPlaceEvent) {
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
if (event instanceof BlockPlaceEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "place")) {
|
||||||
return checkBlockPlace(player, (BlockPlaceEvent) event);
|
return checkBlockPlace(player, (BlockPlaceEvent) event);
|
||||||
} else if (event instanceof BlockBreakEvent) {
|
} else if (event instanceof BlockBreakEvent
|
||||||
|
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "break")) {
|
||||||
return checkBlockBreak(player, (BlockBreakEvent) event);
|
return checkBlockBreak(player, (BlockBreakEvent) event);
|
||||||
|
} else if (event instanceof PlayerInteractEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "interact")) {
|
||||||
|
return checkInteract(player, (PlayerInteractEvent) event);
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CheckResult checkInteract(Player player, PlayerInteractEvent event) {
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
double distance = player.getEyeLocation().toVector().distance(event.getClickedBlock().getLocation().toVector());
|
||||||
|
double maxDistance = player.getGameMode() == GameMode.CREATIVE
|
||||||
|
? checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "creativeRange")
|
||||||
|
: checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "survivalRange");
|
||||||
|
|
||||||
|
maxDistance += user.isLagging() ? 0.12 : 0;
|
||||||
|
maxDistance += user.getPing()
|
||||||
|
* checksConfig.getInteger(CheckType.ILLEGAL_INTERACT, "interact", "pingCompensation");
|
||||||
|
maxDistance += player.getVelocity().length()
|
||||||
|
* checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "velocityMultiplier");
|
||||||
|
if (distance > maxDistance) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "tried to interact out of range (dist=" + distance + ", max=" + maxDistance + ")");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
@@ -63,6 +89,7 @@ public class IllegalInteract {
|
|||||||
|
|
||||||
private static boolean isValidTarget(Player player, Block block) {
|
private static boolean isValidTarget(Player player, Block block) {
|
||||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double distance = player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
double distance = player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
||||||
: player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
: player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
||||||
: magic.BLOCK_MAX_DISTANCE();
|
: magic.BLOCK_MAX_DISTANCE();
|
||||||
@@ -86,7 +113,7 @@ public class IllegalInteract {
|
|||||||
double yawDifference = KillAuraCheck.calculateYawDifference(eyeLocation, block.getLocation());
|
double yawDifference = KillAuraCheck.calculateYawDifference(eyeLocation, block.getLocation());
|
||||||
double playerYaw = player.getEyeLocation().getYaw();
|
double playerYaw = player.getEyeLocation().getYaw();
|
||||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||||
if (Math.round(angleDifference) > magic.ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE()) {
|
if (Math.round(angleDifference) > checksConfig.getInteger(CheckType.ILLEGAL_INTERACT, "maxAngleDifference")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+6
-6
@@ -42,7 +42,7 @@ public class YamlChecksHolder extends ConfigurationFile implements Checks {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getBoolean(CheckType checkType, String subcheck, String name) {
|
public boolean getBoolean(CheckType checkType, String subcheck, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getConfigurationSection(subcheck)
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
||||||
.getBoolean(name);
|
.getBoolean(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,29 +53,29 @@ public class YamlChecksHolder extends ConfigurationFile implements Checks {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDouble(CheckType checkType, String subcheck, String name) {
|
public double getDouble(CheckType checkType, String subcheck, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getConfigurationSection(subcheck)
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
||||||
.getDouble(name);
|
.getDouble(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInteger(CheckType checkType, String subcheck, String name) {
|
public int getInteger(CheckType checkType, String subcheck, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getConfigurationSection(subcheck)
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
||||||
.getInt(name);
|
.getInt(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getBoolean(CheckType checkType, String name) {
|
public boolean getBoolean(CheckType checkType, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getBoolean(name);
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getBoolean(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDouble(CheckType checkType, String name) {
|
public double getDouble(CheckType checkType, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getDouble(name);
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getDouble(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInteger(CheckType checkType, String name) {
|
public int getInteger(CheckType checkType, String name) {
|
||||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getInt(name);
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getInt(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ public interface Magic {
|
|||||||
* Time to exempt a player from moving because of entering/exiting a vehicle; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of entering/exiting a vehicle; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int ENTERED_EXITED_TIME();
|
public int ENTERED_EXITED_TIME();
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of entering/exiting sneak mode; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int SNEAK_TIME();
|
|
||||||
/**
|
/**
|
||||||
* Time to exempt a player from moving because of teleporting; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of teleporting; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
@@ -114,14 +110,6 @@ public interface Magic {
|
|||||||
* Time a player is forced to wait after fastbreak has been detected; Type=SYSTEM, Leniency=DECREASE.
|
* Time a player is forced to wait after fastbreak has been detected; Type=SYSTEM, Leniency=DECREASE.
|
||||||
*/
|
*/
|
||||||
public int FASTBREAK_MAXVIOLATIONTIME();
|
public int FASTBREAK_MAXVIOLATIONTIME();
|
||||||
/**
|
|
||||||
* Number of blocks that can be broken without being hit before taking action; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTPLACE_ZEROLIMIT();
|
|
||||||
/**
|
|
||||||
* Minimum time in between block places; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int FASTPLACE_TIMEMIN();
|
|
||||||
/**
|
/**
|
||||||
* Number of times fastplace can be observed before taking action; Type=INTEGER, Leniency=INCREASE.
|
* Number of times fastplace can be observed before taking action; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
@@ -154,22 +142,6 @@ public interface Magic {
|
|||||||
* Number of chat spam violations before action two is executed; Type=INTEGER, Leniency=INCREASE.
|
* Number of chat spam violations before action two is executed; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int CHAT_ACTION_TWO_LEVEL();
|
public int CHAT_ACTION_TWO_LEVEL();
|
||||||
/**
|
|
||||||
* Number of times a player can be caught in-glide before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int GLIDE_LIMIT();
|
|
||||||
/**
|
|
||||||
* How many blocks you can travel before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double FLIGHT_BLOCK_LIMIT();
|
|
||||||
/**
|
|
||||||
* Maximum speed that a player can climb a waterfall; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double WATER_CLIMB_MAX();
|
|
||||||
/**
|
|
||||||
* Number of times a player can fail a velocity check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int VELOCITY_TIME();
|
|
||||||
/**
|
/**
|
||||||
* Time used to schedule increasing a players velocity count - probably not touching this would be good; Type=INTEGER.
|
* Time used to schedule increasing a players velocity count - probably not touching this would be good; Type=INTEGER.
|
||||||
*/
|
*/
|
||||||
@@ -186,10 +158,6 @@ public interface Magic {
|
|||||||
* Number of times a player can fail the velocity check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
* Number of times a player can fail the velocity check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int VELOCITY_MAXTIMES();
|
public int VELOCITY_MAXTIMES();
|
||||||
/**
|
|
||||||
* Number of times a player can fail the nofall check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int NOFALL_LIMIT();
|
|
||||||
/**
|
/**
|
||||||
* Number of times a player can sprint without proper food level before action is taken; Type=INTEGER, Leniency=INCREASE.
|
* Number of times a player can sprint without proper food level before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
@@ -262,14 +230,6 @@ public interface Magic {
|
|||||||
* Minimum speed a player on a ladder can travel; Type=DOUBLE, Leniency=DECREASE.
|
* Minimum speed a player on a ladder can travel; Type=DOUBLE, Leniency=DECREASE.
|
||||||
*/
|
*/
|
||||||
public double LADDER_Y_MIN();
|
public double LADDER_Y_MIN();
|
||||||
/**
|
|
||||||
* Maximum speed a player on a ladder can travel downwards
|
|
||||||
*/
|
|
||||||
public double LADDER_DOWN_MAX();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards while sneaking; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_SNEAK();
|
|
||||||
/**
|
/**
|
||||||
* The number of clicks we should wait before checking if the player has used fast inventory; Type=INTEGER; Leniency=INCREASE.
|
* The number of clicks we should wait before checking if the player has used fast inventory; Type=INTEGER; Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
@@ -282,46 +242,6 @@ public interface Magic {
|
|||||||
* Minimum travel distance for move to be considered a teleport and subsequently be ignored; Type=INTEGER, Leniency=INCREASE.
|
* Minimum travel distance for move to be considered a teleport and subsequently be ignored; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int TELEPORT_MIN();
|
public int TELEPORT_MIN();
|
||||||
/**
|
|
||||||
* The amount of milliseconds to compensate for a teleport; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int MOREPACKETS_TELEPORT_COMPENSATION();
|
|
||||||
/**
|
|
||||||
* The amount of milliseconds that were offset to flag for MorePackets; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int MOREPACKETS_TRIGGER_BALANCE();
|
|
||||||
/**
|
|
||||||
* The maximum amount of overall lag compensating in milliseconds; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int MOREPACKETS_MINIMUM_CLAMP();
|
|
||||||
/**
|
|
||||||
* Maximum amount of low/zero velocity moments before flagging; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int VELOCITY_MAX_FLAGS();
|
|
||||||
/**
|
|
||||||
* The maximum angle difference allowed when attacking; TYPE=INTEGER, Leniency=INCREASE
|
|
||||||
*/
|
|
||||||
public int KILLAURA_MAX_ANGLE_DIFFERENCE();
|
|
||||||
/**
|
|
||||||
* The maximum amount of violations before flagging player as a cheater; TYPE=INTEGER, Leniency=INCREASE
|
|
||||||
*/
|
|
||||||
public int KILLAURA_MAX_ANGLE_VIOLATIONS();
|
|
||||||
/**
|
|
||||||
* The maximum angle difference allowed when breaking or placing blocks; TYPE=INTEGER, Leniency=INCREASE
|
|
||||||
*/
|
|
||||||
public int ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE();
|
|
||||||
/**
|
|
||||||
* The minimum time it takes to regenerate health; TYPE=INTEGER, Leniency=DECREASE
|
|
||||||
*/
|
|
||||||
public int MIN_HEAL_TIME();
|
|
||||||
/**
|
|
||||||
* Maximum distance allowed between two movement packets; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double BADPACKETS_MAX_DISTANCE();
|
|
||||||
/**
|
|
||||||
* Maximum amount of fastladder movements before flagging; TYPE=INTEGER, Leniency=INCREASE
|
|
||||||
*/
|
|
||||||
public int FASTLADDER_MAX_FLAGS();
|
|
||||||
/**
|
/**
|
||||||
* The change milliseconds between two keepalives before considering a player to be lagging; TYPE=INTEGER, Leniency=DECREASE
|
* The change milliseconds between two keepalives before considering a player to be lagging; TYPE=INTEGER, Leniency=DECREASE
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class BlockListener extends EventListener {
|
public class BlockListener extends EventListener {
|
||||||
@@ -102,16 +103,6 @@ public class BlockListener extends EventListener {
|
|||||||
noHack = false;
|
noHack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO fix
|
|
||||||
/* if (getCheckManager().willCheck(player, CheckType.LONG_REACH)) {
|
|
||||||
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
|
||||||
result = getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.LONG_REACH);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||||
result = IllegalInteract.performCheck(player, event);
|
result = IllegalInteract.performCheck(player, event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
|||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
@@ -289,13 +289,18 @@ public class PlayerListener extends EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
|
if (block != null && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
|
||||||
if (block != null) {
|
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||||
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
CheckResult result = IllegalInteract.performCheck(player, event);
|
||||||
getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,12 +380,6 @@ public class PlayerListener extends EventListener {
|
|||||||
log(result.getMessage(), player, CheckType.FLIGHT);
|
log(result.getMessage(), player, CheckType.FLIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
|
||||||
CheckResult result = GlideCheck.runCheck(player, distance);
|
|
||||||
if (result.failed()) {
|
|
||||||
log(result.getMessage(), player, CheckType.FLIGHT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
||||||
CheckResult result = ElytraCheck.runCheck(player, distance);
|
CheckResult result = ElytraCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class MovementManager {
|
|||||||
public boolean bottomSolid;
|
public boolean bottomSolid;
|
||||||
// If the current movement is up a slab or stair
|
// If the current movement is up a slab or stair
|
||||||
public boolean halfMovement;
|
public boolean halfMovement;
|
||||||
// If the player is on the ground
|
// If the player is on the ground (determined clientside!)
|
||||||
public boolean onGround;
|
public boolean onGround;
|
||||||
// Ticks counter for last halfMovement
|
// Ticks counter for last halfMovement
|
||||||
public int halfMovementHistoryCounter = 0;
|
public int halfMovementHistoryCounter = 0;
|
||||||
@@ -66,7 +66,10 @@ public class MovementManager {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void handle(Player player, Location from, Location to, Distance distance) {
|
public void handle(Player player, Location from, Location to, Distance distance) {
|
||||||
this.onGround = player.isOnGround(); // TODO temp solution, can be spoofed
|
// TODO as of now, we "trust" the client to send the right thing
|
||||||
|
// 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 x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public enum Permission {
|
|||||||
CHECK_FLIGHT, CHECK_ELYTRAFLY, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
CHECK_FLIGHT, CHECK_ELYTRAFLY, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||||
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
||||||
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_UNICODE,
|
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_UNICODE,
|
||||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER, CHECK_AIMBOT,
|
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_BADPACKETS,
|
||||||
|
CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER, CHECK_AIMBOT,
|
||||||
|
|
||||||
/* System Nodes */
|
/* System Nodes */
|
||||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD, SYSTEM_MUTE;
|
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD, SYSTEM_MUTE;
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
# AntiCheatReloaded checks configuration file
|
# AntiCheatReloaded checks configuration file
|
||||||
# Flight check settings
|
# Flight check settings
|
||||||
flight:
|
flight:
|
||||||
# Checks for gliding behaviour
|
|
||||||
# Debugs as 'had gliding behaviour'
|
|
||||||
glide:
|
|
||||||
# Should this part of the check be enabled?
|
|
||||||
enabled: true
|
|
||||||
# Amount of glide-like moves before flagging
|
|
||||||
vlBeforeFlag: 3
|
|
||||||
# Checks for prolonged air movement
|
# Checks for prolonged air movement
|
||||||
# Debugs as 'tried to fly on the Y-axis' or 'had too little Y dropoff'
|
# Debugs as 'tried to fly on the Y-axis' or 'had too little Y dropoff'
|
||||||
airFlight:
|
airFlight:
|
||||||
@@ -21,7 +14,7 @@ flight:
|
|||||||
accountForTpsDrops: 250
|
accountForTpsDrops: 250
|
||||||
# How many milliseconds to account for teleports
|
# How many milliseconds to account for teleports
|
||||||
# Increase this is you debug 'had too little Y dropoff' after teleports
|
# Increase this is you debug 'had too little Y dropoff' after teleports
|
||||||
accountForTeleports: 50
|
accountForTeleports: 100
|
||||||
# Checks for climbing behaviour in air
|
# Checks for climbing behaviour in air
|
||||||
# Debugs as 'tried to climb air'
|
# Debugs as 'tried to climb air'
|
||||||
airClimb:
|
airClimb:
|
||||||
@@ -35,8 +28,21 @@ flight:
|
|||||||
groundFlight:
|
groundFlight:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# Checks if a player ignores gravity
|
||||||
|
# Debugs as 'ignored gravity'
|
||||||
|
gravity:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Maximum offset between predicted and actual gravity
|
||||||
|
maxOffset: 0.005
|
||||||
|
# How many milliseconds to account for teleports
|
||||||
|
# Increase this is you debug 'ignored gravity' after teleports
|
||||||
|
accountForTeleports: 100
|
||||||
|
# Amount of illegal moves before flagging
|
||||||
|
vlBeforeFlag: 5
|
||||||
|
|
||||||
# ElytraFly check settings
|
# ElytraFly check settings
|
||||||
|
# Checks for illegal upward elytra movement
|
||||||
elytrafly:
|
elytrafly:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -88,18 +94,18 @@ speed:
|
|||||||
climbableCompensation: 0.04
|
climbableCompensation: 0.04
|
||||||
|
|
||||||
# WaterWalk check settings
|
# WaterWalk check settings
|
||||||
|
# Checks if a player is walking on water
|
||||||
waterwalk:
|
waterwalk:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# FastLadder check settings
|
# FastLadder check settings
|
||||||
|
# Checks if a player moves too fast on a ladder
|
||||||
fastladder:
|
fastladder:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Maximum speed a player on a ladder can travel
|
# Maximum speed a player on a ladder can travel upwards
|
||||||
speedMax: 0.11761
|
speedUpMax: 0.11761
|
||||||
# Minimum speed a player on a ladder will travel
|
|
||||||
speedMin: 0.11759
|
|
||||||
# Maximum speed a player on a ladder can travel downwards
|
# Maximum speed a player on a ladder can travel downwards
|
||||||
speedDownMax: 0.15
|
speedDownMax: 0.15
|
||||||
# Amount of illegal ladder moves before flagging
|
# Amount of illegal ladder moves before flagging
|
||||||
@@ -169,11 +175,13 @@ fastbreak:
|
|||||||
fastplace:
|
fastplace:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# Minimum time in milliseconds between block places
|
||||||
|
minimumTime: 50
|
||||||
|
|
||||||
# IllegalInteract check settings
|
# IllegalInteract check settings
|
||||||
illegalinteract:
|
illegalinteract:
|
||||||
# Maximum difference in angle from the players view
|
# Maximum difference in angle from the players view
|
||||||
maxAngleDifference: 80
|
maxAngleDifference: 90
|
||||||
# Checks angle when breaking a block
|
# Checks angle when breaking a block
|
||||||
# Debugs as 'tried to break a block which was out of view'
|
# Debugs as 'tried to break a block which was out of view'
|
||||||
break:
|
break:
|
||||||
@@ -184,6 +192,19 @@ illegalinteract:
|
|||||||
place:
|
place:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# Checks angle when placing a block
|
||||||
|
# Debugs as 'tried to interact out of range' or 'tried to interact out of view'
|
||||||
|
interact:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Default survival interact range
|
||||||
|
survivalRange: 5.5
|
||||||
|
# Default creative interact range
|
||||||
|
creativeRange: 6.5
|
||||||
|
# Extra allowed reach distance per millisecond of ping
|
||||||
|
pingCompensation: 0.0045
|
||||||
|
# The multiplier of extra compensation for velocity
|
||||||
|
velocityMultiplier: 1.5
|
||||||
|
|
||||||
# BadPackets check settings
|
# BadPackets check settings
|
||||||
badpackets:
|
badpackets:
|
||||||
@@ -204,6 +225,8 @@ morepackets:
|
|||||||
minimumClamp: 500
|
minimumClamp: 500
|
||||||
# The amount of milliseconds offset between packets before flagging (50ms = 1 tick)
|
# The amount of milliseconds offset between packets before flagging (50ms = 1 tick)
|
||||||
triggerBalance: 100
|
triggerBalance: 100
|
||||||
|
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
||||||
|
teleportCompensation: 150
|
||||||
# Should MorePackets be disabled for 'lagging' players?
|
# Should MorePackets be disabled for 'lagging' players?
|
||||||
# This can easily be spoofed by clients!
|
# This can easily be spoofed by clients!
|
||||||
disableForLagging: false
|
disableForLagging: false
|
||||||
@@ -212,9 +235,14 @@ morepackets:
|
|||||||
maxPing: -1
|
maxPing: -1
|
||||||
|
|
||||||
# Sneak check settings
|
# Sneak check settings
|
||||||
|
# Checks if a player moves too fast when sneaking
|
||||||
sneak:
|
sneak:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# Maximum speed a player can travel on the xz-axis while sneaking
|
||||||
|
xzMaxSneaking: 0.15
|
||||||
|
# Amount of illegal movements before flagging
|
||||||
|
vlBeforeFlag: 3
|
||||||
|
|
||||||
# Spider check settings
|
# Spider check settings
|
||||||
spider:
|
spider:
|
||||||
@@ -225,6 +253,8 @@ spider:
|
|||||||
nofall:
|
nofall:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# Amount of moves with a modified fall distance before flagging
|
||||||
|
vlBeforeFlag: 6
|
||||||
|
|
||||||
# NoSwing check settings
|
# NoSwing check settings
|
||||||
noswing:
|
noswing:
|
||||||
@@ -250,6 +280,15 @@ fasteat:
|
|||||||
fastheal:
|
fastheal:
|
||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# Minimum server TPS needed for FastHeal to be active
|
||||||
|
minimumTps: 17.5
|
||||||
|
# Should FastHeal be disabled for 'lagging' players?
|
||||||
|
# This can easily be spoofed by clients!
|
||||||
|
disableForLagging: false
|
||||||
|
# The minimum time it takes to regenerate health in milliseconds
|
||||||
|
minHealTime: 495
|
||||||
|
# Amount of milliseconds a player can heal faster per millisecond of ping
|
||||||
|
pingCompensation: 0.15
|
||||||
|
|
||||||
# FastProjectile check settings
|
# FastProjectile check settings
|
||||||
fastprojectile:
|
fastprojectile:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# Options; WARN, KICK, COMMAND[your command here] or NONE
|
# Options; WARN, KICK, COMMAND[your command here] or NONE
|
||||||
# To disable warnings or kicking, change WARN and/or KICK to NONE
|
# To disable warnings or kicking, change WARN and/or KICK to NONE
|
||||||
groups:
|
groups:
|
||||||
- 'Medium : 75 : YELLOW : WARN'
|
- 'Low : 50 : GREEN : NONE'
|
||||||
- 'High : 150 : RED : KICK'
|
- 'Medium : 100 : YELLOW : WARN'
|
||||||
|
- 'High : 175 : RED : KICK'
|
||||||
- 'Custom : -1 : GREEN : COMMAND[ban %player%;]'
|
- 'Custom : -1 : GREEN : COMMAND[ban %player%;]'
|
||||||
Reference in new issue
Block a user