v1.1.2: fix reload decay task, nofall blocks, config cleanup, sqrt removal

This commit is contained in:
2026-03-15 12:36:46 -03:00
parent 68e99adf3e
commit 95e0915d67
8 changed files with 26 additions and 11 deletions

View File

@@ -2,6 +2,13 @@
Lightweight, accurate anti-cheat for Paper 1.21.x Lightweight, accurate anti-cheat for Paper 1.21.x
## Latest Updates (v1.1.2)
- **reload**: `violation.decay_interval` changes now take effect immediately — the decay task is cancelled and recreated on every `/xac reload`.
- **NoFallCheck**: Added Beds (all 16 colour variants via `Tag.BEDS`) and Powder Snow to the list of blocks that cancel fall damage. Eliminates false positives when players land on these blocks.
- **config.yml**: Removed orphaned `allow_jump_crits` key from `checks.critical` section (was removed from code in v1.1.1).
- **JesusCheck, GlideCheck**: Eliminated `Math.sqrt()` from hot-path threshold comparisons.
## Latest Updates (v1.1.1) ## Latest Updates (v1.1.1)
- **CriticalCheck**: Removed dead code — the "no-air crit" detection branch was logically unreachable because `isCritical=true` requires `!isOnGround`, making the subsequent `isOnGround` check always false. The check now only flags "crit while sprinting" (the only branch that could actually fire). Removed `allow_jump_crits` config key. (Future enhancement: Option B damage-ratio detection.) - **CriticalCheck**: Removed dead code — the "no-air crit" detection branch was logically unreachable because `isCritical=true` requires `!isOnGround`, making the subsequent `isOnGround` check always false. The check now only flags "crit while sprinting" (the only branch that could actually fire). Removed `allow_jump_crits` config key. (Future enhancement: Option B damage-ratio detection.)

View File

@@ -6,7 +6,7 @@
<groupId>com.xeroth</groupId> <groupId>com.xeroth</groupId>
<artifactId>xeroanticheat</artifactId> <artifactId>xeroanticheat</artifactId>
<version>1.1.1</version> <version>1.1.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>XeroAntiCheat</name> <name>XeroAntiCheat</name>

View File

@@ -44,6 +44,7 @@ public final class XeroAntiCheat extends JavaPlugin {
private DatabaseManager databaseManager; private DatabaseManager databaseManager;
private boolean protocolLibLoaded = false; private boolean protocolLibLoaded = false;
private org.bukkit.scheduler.BukkitTask decayTask;
// Staff alert toggles // Staff alert toggles
private final Map<UUID, Boolean> alertToggles = new ConcurrentHashMap<>(); private final Map<UUID, Boolean> alertToggles = new ConcurrentHashMap<>();
@@ -174,7 +175,7 @@ public final class XeroAntiCheat extends JavaPlugin {
private void startDecayTask() { private void startDecayTask() {
int interval = configManager.getInt("violation.decay_interval", 30) * 20; int interval = configManager.getInt("violation.decay_interval", 30) * 20;
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> { decayTask = Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
violationManager.decayAll(); violationManager.decayAll();
}, interval, interval); }, interval, interval);
} }
@@ -233,6 +234,12 @@ public final class XeroAntiCheat extends JavaPlugin {
violationManager.clearAll(); violationManager.clearAll();
violationManager.setDecayRate( violationManager.setDecayRate(
configManager.getDouble("violation.decay_rate", 0.5)); configManager.getDouble("violation.decay_rate", 0.5));
if (decayTask != null) {
decayTask.cancel();
}
startDecayTask();
getLogger().info("Configuration reloaded!"); getLogger().info("Configuration reloaded!");
} }

View File

@@ -37,11 +37,12 @@ public class GlideCheck extends Check {
// Get velocity // Get velocity
org.bukkit.util.Vector velocity = player.getVelocity(); org.bukkit.util.Vector velocity = player.getVelocity();
// Calculate horizontal speed // Calculate horizontal speed (squared to avoid Math.sqrt())
double horizontalSpeed = Math.sqrt(velocity.getX() * velocity.getX() + velocity.getZ() * velocity.getZ()); double horizontalSpeedSq = velocity.getX() * velocity.getX() + velocity.getZ() * velocity.getZ();
// Check if moving fast horizontally // Check if moving fast horizontally
if (horizontalSpeed < minHorizontalSpeed) { double minHorizSq = minHorizontalSpeed * minHorizontalSpeed;
if (horizontalSpeedSq < minHorizSq) {
data.resetGlideTicks(); data.resetGlideTicks();
return; return;
} }

View File

@@ -72,10 +72,10 @@ public class JesusCheck extends Check {
if (current != null && last != null) { if (current != null && last != null) {
double dx = current.x() - last.x(); double dx = current.x() - last.x();
double dz = current.z() - last.z(); double dz = current.z() - last.z();
double horizontalSpeed = Math.sqrt(dx * dx + dz * dz); double horizontalSpeedSq = dx * dx + dz * dz;
// If moving at reasonable speed on water, flag // If moving at reasonable speed on water, flag
if (horizontalSpeed > 0.1) { if (horizontalSpeedSq > 0.01) {
flag(data, player); flag(data, player);
} }
} }

View File

@@ -61,7 +61,9 @@ public class NoFallCheck extends Check {
blockBelow == Material.HONEY_BLOCK || blockBelow == Material.HONEY_BLOCK ||
blockBelow == Material.HAY_BLOCK || blockBelow == Material.HAY_BLOCK ||
blockBelow == Material.SLIME_BLOCK || blockBelow == Material.SLIME_BLOCK ||
blockBelow == Material.COBWEB) { blockBelow == Material.COBWEB ||
blockBelow == Material.POWDER_SNOW ||
org.bukkit.Tag.BEDS.isTagged(blockBelow)) {
data.setLastExpectedFallDamage(0.0); data.setLastExpectedFallDamage(0.0);
return; return;
} }

View File

@@ -175,8 +175,6 @@ checks:
# ---------------------------------------- # ----------------------------------------
critical: critical:
enabled: true enabled: true
# Allow legitimate jump-crits
allow_jump_crits: true
warn_vl: 10 warn_vl: 10
kick_vl: 25 kick_vl: 25
tempban_vl: 50 tempban_vl: 50

View File

@@ -1,5 +1,5 @@
name: XeroAntiCheat name: XeroAntiCheat
version: 1.1.1 version: 1.1.2
main: com.xeroth.xeroanticheat.XeroAntiCheat main: com.xeroth.xeroanticheat.XeroAntiCheat
author: Xeroth author: Xeroth
description: Lightweight, accurate anti-cheat for Paper 1.21.x description: Lightweight, accurate anti-cheat for Paper 1.21.x