XeroAntiCheat v1.0.9 bug fixes

- BUG-1: Added alerts.cooldown_ms (default 5s) to throttle warn() and
  sendAlert() in PunishmentManager, preventing chat spam during high-frequency
  flags. Verbose output in ViolationManager also respects the cooldown.
  Kick/ban punishments always fire immediately regardless of cooldown.
- BUG-2: Fixed FlyCheck false positive with Jump Boost I - condition was
  incorrectly flagging players with Jump Boost level 1. Now exempts all
  jump boost levels from the sustained-flight flag.
- BUG-3: Optimized SpiderCheck by caching player.getLocation() in a single
  variable instead of calling it 3 times.
This commit is contained in:
2026-03-15 03:51:27 -03:00
parent 38ab1abaf1
commit 8190b39160
9 changed files with 50 additions and 18 deletions

View File

@@ -171,6 +171,7 @@ public class ConfigManager {
DEFAULTS.put("alerts.enabled", true);
DEFAULTS.put("alerts.format", "<dark_red>[<red>XAC<dark_red>] <white>%player% <red>failed <white>%check% <red>(VL: <white>%vl%<red>)");
DEFAULTS.put("alerts.staff_format", "<gray>[%time%] %message%");
DEFAULTS.put("alerts.cooldown_ms", 5000);
// Commands
DEFAULTS.put("commands.reload_permission", "xac.admin");

View File

@@ -76,7 +76,17 @@ public class PunishmentManager {
Check check = plugin.getCheckManager().getCheck(checkName);
String category = check != null ? check.getCategory() : "misc";
sendAlert(player, checkName, vl, category);
long cooldownMs = plugin.getConfigManager().getInt("alerts.cooldown_ms", 5000);
long now = System.currentTimeMillis();
long lastWarn = data.getLastWarnTime(checkName);
boolean cooledDown = (now - lastWarn) >= cooldownMs;
boolean isPunishment = vl >= kickVl;
if (cooledDown || isPunishment) {
sendAlert(player, checkName, vl, category);
data.setLastWarnTime(checkName, now);
}
if (vl >= permbanVl) {
punish(player, checkName, "PERMBAN", permbanVl);
@@ -84,7 +94,7 @@ public class PunishmentManager {
punish(player, checkName, "TEMPBAN", tempbanVl);
} else if (vl >= kickVl) {
punish(player, checkName, "KICK", kickVl);
} else if (vl >= warnVl) {
} else if (vl >= warnVl && cooledDown) {
warn(player, checkName);
}
}

View File

@@ -62,16 +62,21 @@ public class ViolationManager {
double newVl = data.getViolationLevel(checkName);
if (plugin.isVerboseTarget(player.getUniqueId())) {
Component verbose = miniMessage.deserialize(
"<gray>[<white>VERBOSE<gray>] <yellow>" + player.getName()
+ " <gray>» <white>" + checkName
+ " <gray>+<green>" + String.format("%.1f", weight)
+ " <gray>(VL: <white>" + String.format("%.1f", newVl) + "<gray>)"
);
for (Player staff : Bukkit.getOnlinePlayers()) {
if (staff.hasPermission("xac.command.verbose") || staff.hasPermission("xac.admin")) {
staff.sendMessage(verbose);
long cooldownMs = plugin.getConfigManager().getInt("alerts.cooldown_ms", 5000);
long now = System.currentTimeMillis();
if ((now - data.getLastWarnTime(checkName)) >= cooldownMs) {
Component verbose = miniMessage.deserialize(
"<gray>[<white>VERBOSE<gray>] <yellow>" + player.getName()
+ " <gray>» <white>" + checkName
+ " <gray>+<green>" + String.format("%.1f", weight)
+ " <gray>(VL: <white>" + String.format("%.1f", newVl) + "<gray>)"
);
for (Player staff : Bukkit.getOnlinePlayers()) {
if (staff.hasPermission("xac.command.verbose") || staff.hasPermission("xac.admin")) {
staff.sendMessage(verbose);
}
}
data.setLastWarnTime(checkName, now);
}
}