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:
@@ -53,8 +53,12 @@ public class SpeedCheck extends Check {
|
||||
double speed = horizontalDistance / (timeDelta / 50.0);
|
||||
|
||||
// Get server TPS
|
||||
double tps = org.bukkit.Bukkit.getTPS()[0];
|
||||
double tpsMultiplier = 20.0 / Math.max(tps, 18.0);
|
||||
double tpsMultiplier = 1.0;
|
||||
if (plugin.getConfigManager().getBoolean("tps.enabled", true)) {
|
||||
double tps = org.bukkit.Bukkit.getTPS()[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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
# ==========================================
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user