v1.1.3: Fix config/code consistency issues

- SpeedCheck: tps.enabled and tps.min_tps_threshold now work (was hardcoded)
- ConfigManager/config.yml: Removed orphaned async_task_threads and commands.* keys
- PunishmentManager: database.enabled now correctly disables SQLite logging
- PacketListener: Removed dead code (updatePacketTiming, recordClick, recordAttack)
This commit is contained in:
2026-03-15 12:47:43 -03:00
parent 95e0915d67
commit a4a87e62de
8 changed files with 17 additions and 76 deletions

View File

@@ -2,6 +2,13 @@
Lightweight, accurate anti-cheat for Paper 1.21.x
## Latest Updates (v1.1.3)
- **SpeedCheck**: `tps.min_tps_threshold` and `tps.enabled` config keys now actually work — previously hardcoded as `18.0` and always-on.
- **config.yml**: Removed orphaned `async_task_threads` key and entire `commands:` section — these were never read by the plugin.
- **PunishmentManager**: `database.enabled: false` now correctly disables SQLite punishment logging as documented.
- **PacketListener**: Removed three unreachable fallback methods (`updatePacketTiming`, `recordClick`, `recordAttack`) — dead code since v1.0.4.
## 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`.

View File

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

View File

@@ -53,8 +53,12 @@ public class SpeedCheck extends Check {
double speed = horizontalDistance / (timeDelta / 50.0);
// Get server TPS
double tpsMultiplier = 1.0;
if (plugin.getConfigManager().getBoolean("tps.enabled", true)) {
double tps = org.bukkit.Bukkit.getTPS()[0];
double tpsMultiplier = 20.0 / Math.max(tps, 18.0);
double minTps = plugin.getConfigManager().getDouble("tps.min_tps_threshold", 18.0);
tpsMultiplier = 20.0 / Math.max(tps, minTps);
}
// Calculate max speed based on player state
double maxSpeed = calculateMaxSpeed(player, data);

View File

@@ -27,7 +27,6 @@ public class ConfigManager {
// General
DEFAULTS.put("enabled", true);
DEFAULTS.put("debug", false);
DEFAULTS.put("async_task_threads", 2);
// Violation
DEFAULTS.put("violation.decay_interval", 30);
@@ -172,11 +171,6 @@ public class ConfigManager {
DEFAULTS.put("alerts.staff_format", "<gray>[%time%] %message%");
DEFAULTS.put("alerts.cooldown_ms", 5000);
// Commands
DEFAULTS.put("commands.reload_permission", "xac.admin");
DEFAULTS.put("commands.bypass_permission", "xac.bypass");
DEFAULTS.put("commands.alerts_permission", "xac.alerts");
// TPS
DEFAULTS.put("tps.enabled", true);
DEFAULTS.put("tps.min_tps_threshold", 18.0);

View File

@@ -207,7 +207,8 @@ public class PunishmentManager {
}
DatabaseManager db = plugin.getDatabaseManager();
if (db != null && db.isAvailable()) {
boolean dbEnabled = plugin.getConfigManager().getBoolean("database.enabled", true);
if (db != null && db.isAvailable() && dbEnabled) {
db.insertPunishment(timestamp, type, playerUuid, playerName, checkName, vl);
}
});

View File

@@ -152,56 +152,6 @@ public class PacketListener {
return protocolLibAvailable;
}
/**
* Update packet timing (called from event listeners when ProtocolLib unavailable)
*/
public void updatePacketTiming(Player player) {
if (protocolLibAvailable) {
return;
}
PlayerData data = plugin.getViolationManager().getPlayerData(player);
if (data == null) return;
long now = System.currentTimeMillis();
data.setLastMovePacketTime(now);
if (now - data.getLastPacketCountReset() > 1000) {
data.setPacketsThisSecond(0);
data.setLastPacketCountReset(now);
}
data.incrementPacketsThisSecond();
}
/**
* Record click (called from event listeners when ProtocolLib unavailable)
*/
public void recordClick(Player player) {
if (protocolLibAvailable) {
return;
}
PlayerData data = plugin.getViolationManager().getPlayerData(player);
if (data != null) {
data.addClick();
}
}
/**
* Record attack (called from event listeners when ProtocolLib unavailable)
*/
public void recordAttack(Player player, java.util.UUID entityUuid) {
if (protocolLibAvailable) {
return;
}
PlayerData data = plugin.getViolationManager().getPlayerData(player);
if (data != null) {
data.addAttack(entityUuid);
data.setLastAttackYaw(player.getLocation().getYaw());
}
}
/**
* Unregister all packet listeners
*/

View File

@@ -12,9 +12,6 @@ enabled: true
# Enable debug mode (logs additional information)
debug: false
# Number of async threads for background tasks
async_task_threads: 2
# Database settings
database:
# Set to false to disable SQLite logging (flat-file log always active)
@@ -319,18 +316,6 @@ alerts:
# Default: 5000ms (5 seconds). Set to 0 to disable throttling.
cooldown_ms: 5000
# ==========================================
# COMMANDS
# ==========================================
commands:
# Permission required for admin commands
reload_permission: "xac.admin"
# Permission to bypass all checks
bypass_permission: "xac.bypass"
# Permission to receive alerts
alerts_permission: "xac.alerts"
# ==========================================
# TPS COMPENSATION
# ==========================================

View File

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