mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +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) {
|
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) || player.getVehicle() != null
|
||||||
// This was a teleport or user is flying/using elytra, so we don't care
|
|| 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.
|
// about it.
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,18 +229,15 @@ public class SpeedCheck {
|
|||||||
|
|
||||||
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
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())
|
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
.getMovementManager();
|
.getMovementManager();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
||||||
return PASS;
|
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()),
|
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
||||||
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), movementManager.halfMovement, checksConfig);
|
|| 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));
|
double base = couldBeOnBoat ? 0.600000025 : (nearBed ? 0.5625 : (halfMovement ? 0.6 : 0.42));
|
||||||
if (fromClimbable)
|
if (fromClimbable)
|
||||||
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
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;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public class Config extends ConfigurationFile {
|
|||||||
public ConfigValue<List<String>> disabledWorlds;
|
public ConfigValue<List<String>> disabledWorlds;
|
||||||
|
|
||||||
public ConfigValue<Integer> notifyEveryVl;
|
public ConfigValue<Integer> notifyEveryVl;
|
||||||
|
public ConfigValue<Integer> maxSetbackDistance;
|
||||||
|
|
||||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||||
super(plugin, config, FILENAME);
|
super(plugin, config, FILENAME);
|
||||||
@@ -85,5 +86,10 @@ public class Config extends ConfigurationFile {
|
|||||||
if (notifyEveryVl.getValue() < 1) {
|
if (notifyEveryVl.getValue() < 1) {
|
||||||
notifyEveryVl.setValue(5);
|
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.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
@@ -256,9 +257,6 @@ public class PlayerListener extends EventListener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (!event.isSprinting()) {
|
|
||||||
getBackend().logEnterExit(player);
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
||||||
CheckResult result = getBackend().checkSprintHungry(event);
|
CheckResult result = getBackend().checkSprintHungry(event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
@@ -436,7 +434,6 @@ public class PlayerListener extends EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean changed = false;
|
|
||||||
if (event.getTo() != event.getFrom()) {
|
if (event.getTo() != event.getFrom()) {
|
||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
@@ -449,7 +446,6 @@ public class PlayerListener extends EventListener {
|
|||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPEED);
|
log(result.getMessage(), player, CheckType.SPEED);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
||||||
@@ -458,7 +454,6 @@ public class PlayerListener extends EventListener {
|
|||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPEED);
|
log(result.getMessage(), player, CheckType.SPEED);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
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));
|
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.WATER_WALK);
|
log(result.getMessage(), player, CheckType.WATER_WALK);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
||||||
@@ -479,7 +473,6 @@ public class PlayerListener extends EventListener {
|
|||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPIDER);
|
log(result.getMessage(), player, CheckType.SPIDER);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||||
@@ -491,12 +484,8 @@ public class PlayerListener extends EventListener {
|
|||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!changed) {
|
|
||||||
user.setGoodLocation(event.getFrom());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ package com.rammelkast.anticheatreloaded.util;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
|
||||||
public class MovementManager {
|
public class MovementManager {
|
||||||
|
|
||||||
// Ticks in air
|
// Ticks in air
|
||||||
@@ -161,5 +163,8 @@ public class MovementManager {
|
|||||||
if (this.halfMovementHistoryCounter > 0)
|
if (this.halfMovementHistoryCounter > 0)
|
||||||
this.halfMovementHistoryCounter--;
|
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
|
* @return last known valid location
|
||||||
*/
|
*/
|
||||||
public Location getGoodLocation(Location 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;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,11 @@ system:
|
|||||||
# Minimum value is 1, default is 8
|
# Minimum value is 1, default is 8
|
||||||
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
||||||
notify-every-vl: 8
|
notify-every-vl: 8
|
||||||
# Use /AntiCheatReloaded checks for a list of valid checks
|
# Maximum distance a player can be set back
|
||||||
|
# If the last known valid location is further away than this,
|
||||||
|
# the player will be rubberbanded at their current location
|
||||||
|
# Minimum value is 5, default is 50
|
||||||
|
max-setback-distance: 50
|
||||||
disable-in:
|
disable-in:
|
||||||
- example-world
|
- example-world
|
||||||
- example-world-2
|
- example-world-2
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
# Time to exempt a player from moving because of entering/exiting a vehicle
|
# Time to exempt a player from moving because of entering/exiting a vehicle
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
ENTERED_EXITED_TIME: 1000
|
ENTERED_EXITED_TIME: 250
|
||||||
# Time to exempt a player from moving because of teleporting
|
# Time to exempt a player from moving because of teleporting
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
TELEPORT_TIME: 1000
|
TELEPORT_TIME: 1500
|
||||||
# Time to exempt a player from moving because of exiting fly mode
|
# Time to exempt a player from moving because of exiting fly mode
|
||||||
# Changing this value is almost never required
|
# Changing this value is almost never required
|
||||||
EXIT_FLY_TIME: 2000
|
EXIT_FLY_TIME: 2000
|
||||||
|
|||||||
Reference in new issue
Block a user