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

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

View File

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

View File

@@ -72,10 +72,10 @@ public class JesusCheck extends Check {
if (current != null && last != null) {
double dx = current.x() - last.x();
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 (horizontalSpeed > 0.1) {
if (horizontalSpeedSq > 0.01) {
flag(data, player);
}
}

View File

@@ -61,7 +61,9 @@ public class NoFallCheck extends Check {
blockBelow == Material.HONEY_BLOCK ||
blockBelow == Material.HAY_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);
return;
}

View File

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

View File

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