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:
@@ -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.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)
|
## 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`.
|
- **reload**: `violation.decay_interval` changes now take effect immediately — the decay task is cancelled and recreated on every `/xac reload`.
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.xeroth</groupId>
|
<groupId>com.xeroth</groupId>
|
||||||
<artifactId>xeroanticheat</artifactId>
|
<artifactId>xeroanticheat</artifactId>
|
||||||
<version>1.1.2</version>
|
<version>1.1.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>XeroAntiCheat</name>
|
<name>XeroAntiCheat</name>
|
||||||
|
|||||||
@@ -53,8 +53,12 @@ public class SpeedCheck extends Check {
|
|||||||
double speed = horizontalDistance / (timeDelta / 50.0);
|
double speed = horizontalDistance / (timeDelta / 50.0);
|
||||||
|
|
||||||
// Get server TPS
|
// Get server TPS
|
||||||
double tps = org.bukkit.Bukkit.getTPS()[0];
|
double tpsMultiplier = 1.0;
|
||||||
double tpsMultiplier = 20.0 / Math.max(tps, 18.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
|
// Calculate max speed based on player state
|
||||||
double maxSpeed = calculateMaxSpeed(player, data);
|
double maxSpeed = calculateMaxSpeed(player, data);
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ public class ConfigManager {
|
|||||||
// General
|
// General
|
||||||
DEFAULTS.put("enabled", true);
|
DEFAULTS.put("enabled", true);
|
||||||
DEFAULTS.put("debug", false);
|
DEFAULTS.put("debug", false);
|
||||||
DEFAULTS.put("async_task_threads", 2);
|
|
||||||
|
|
||||||
// Violation
|
// Violation
|
||||||
DEFAULTS.put("violation.decay_interval", 30);
|
DEFAULTS.put("violation.decay_interval", 30);
|
||||||
@@ -172,11 +171,6 @@ public class ConfigManager {
|
|||||||
DEFAULTS.put("alerts.staff_format", "<gray>[%time%] %message%");
|
DEFAULTS.put("alerts.staff_format", "<gray>[%time%] %message%");
|
||||||
DEFAULTS.put("alerts.cooldown_ms", 5000);
|
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
|
// TPS
|
||||||
DEFAULTS.put("tps.enabled", true);
|
DEFAULTS.put("tps.enabled", true);
|
||||||
DEFAULTS.put("tps.min_tps_threshold", 18.0);
|
DEFAULTS.put("tps.min_tps_threshold", 18.0);
|
||||||
|
|||||||
@@ -207,7 +207,8 @@ public class PunishmentManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseManager db = plugin.getDatabaseManager();
|
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);
|
db.insertPunishment(timestamp, type, playerUuid, playerName, checkName, vl);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -152,56 +152,6 @@ public class PacketListener {
|
|||||||
return protocolLibAvailable;
|
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
|
* Unregister all packet listeners
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ enabled: true
|
|||||||
# Enable debug mode (logs additional information)
|
# Enable debug mode (logs additional information)
|
||||||
debug: false
|
debug: false
|
||||||
|
|
||||||
# Number of async threads for background tasks
|
|
||||||
async_task_threads: 2
|
|
||||||
|
|
||||||
# Database settings
|
# Database settings
|
||||||
database:
|
database:
|
||||||
# Set to false to disable SQLite logging (flat-file log always active)
|
# 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.
|
# Default: 5000ms (5 seconds). Set to 0 to disable throttling.
|
||||||
cooldown_ms: 5000
|
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
|
# TPS COMPENSATION
|
||||||
# ==========================================
|
# ==========================================
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: XeroAntiCheat
|
name: XeroAntiCheat
|
||||||
version: 1.1.2
|
version: 1.1.3
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user