mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Fix false positive with horse and jump boost, added "max-setback-distance".
This commit is contained in:
1 parent
9850f48a4e
commit
07f957cf35
8 files changed
+31
-27
No files matched your search
@@ -49,8 +49,10 @@ public class FlightCheck {
|
||||
|
||||
public static CheckResult runCheck(Player player, Distance distance) {
|
||||
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||
|| VersionUtil.isFlying(player)) {
|
||||
// This was a teleport or user is flying/using elytra, so we don't care
|
||||
|| VersionUtil.isFlying(player) || player.getVehicle() != null
|
||||
|| AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)) {
|
||||
// This was a teleport or user is flying/using elytra/in a vehicle, so we don't
|
||||
// care
|
||||
// about it.
|
||||
return PASS;
|
||||
}
|
||||
|
||||
@@ -229,18 +229,15 @@ public class SpeedCheck {
|
||||
|
||||
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (isSpeedExempt(player, backend) || player.getVehicle() != null || player.isSleeping()
|
||||
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player))
|
||||
return PASS;
|
||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||
.getMovementManager();
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
||||
return PASS;
|
||||
|
||||
if (player.isInsideVehicle() || player.isSleeping()
|
||||
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_EXTENSION()) || VersionUtil.isFlying(player)
|
||||
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player)) {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
||||
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), movementManager.halfMovement, checksConfig);
|
||||
@@ -260,9 +257,9 @@ public class SpeedCheck {
|
||||
double base = couldBeOnBoat ? 0.600000025 : (nearBed ? 0.5625 : (halfMovement ? 0.6 : 0.42));
|
||||
if (fromClimbable)
|
||||
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||
base += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 0.2D;
|
||||
}
|
||||
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||
base += (player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1) * 0.2D;
|
||||
return base;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class Config extends ConfigurationFile {
|
||||
public ConfigValue<List<String>> disabledWorlds;
|
||||
|
||||
public ConfigValue<Integer> notifyEveryVl;
|
||||
public ConfigValue<Integer> maxSetbackDistance;
|
||||
|
||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
@@ -85,5 +86,10 @@ public class Config extends ConfigurationFile {
|
||||
if (notifyEveryVl.getValue() < 1) {
|
||||
notifyEveryVl.setValue(5);
|
||||
}
|
||||
|
||||
maxSetbackDistance = new ConfigValue<Integer>("system.max-setback-distance");
|
||||
if (maxSetbackDistance.getValue() < 5) {
|
||||
maxSetbackDistance.setValue(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@@ -256,9 +257,6 @@ public class PlayerListener extends EventListener {
|
||||
@EventHandler
|
||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!event.isSprinting()) {
|
||||
getBackend().logEnterExit(player);
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
||||
CheckResult result = getBackend().checkSprintHungry(event);
|
||||
if (result.failed()) {
|
||||
@@ -436,7 +434,6 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
boolean changed = false;
|
||||
if (event.getTo() != event.getFrom()) {
|
||||
double x = distance.getXDifference();
|
||||
double z = distance.getZDifference();
|
||||
@@ -449,7 +446,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPEED);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
||||
@@ -458,7 +454,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPEED);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
||||
@@ -469,7 +464,6 @@ public class PlayerListener extends EventListener {
|
||||
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.WATER_WALK);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
||||
@@ -479,7 +473,6 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPIDER);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||
@@ -491,12 +484,8 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (!changed) {
|
||||
user.setGoodLocation(event.getFrom());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||
|
||||
@@ -21,6 +21,8 @@ package com.rammelkast.anticheatreloaded.util;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
public class MovementManager {
|
||||
|
||||
// Ticks in air
|
||||
@@ -161,5 +163,8 @@ public class MovementManager {
|
||||
if (this.halfMovementHistoryCounter > 0)
|
||||
this.halfMovementHistoryCounter--;
|
||||
}
|
||||
|
||||
// Update "good location"
|
||||
AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).setGoodLocation(from);
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,8 @@ public class User {
|
||||
* @return last known valid location
|
||||
*/
|
||||
public Location getGoodLocation(Location location) {
|
||||
if (goodLocation == null) {
|
||||
if (goodLocation == null || !location.getWorld().equals(goodLocation.getWorld())
|
||||
|| location.distance(goodLocation) > config.getConfig().maxSetbackDistance.getValue()) {
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user