v1.2.0: Implement improvement plan features

- Setback System: Teleports flagged players to lastSafeLocation (opt-in per check)
- TPS Lag Compensation: isServerLagging() helper, guards in Fly/Spider/Glide checks
- Universal Buffer System: Buffer fields for Jesus/Reach/KillAura/Timer/FastPlace/Scaffold/FastEat
- /xac debug command: Shows check-specific debug info for players
- Public API: XACApi with isFlagged(), getViolationLevel(), getTotalViolations(), isBypassed()
- Performance Metrics: /xac stats command with checks/flags/punishments tracking
This commit is contained in:
2026-03-15 13:17:28 -03:00
parent a4a87e62de
commit 112a61cf0c
23 changed files with 387 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ package com.xeroth.xeroanticheat.check;
import com.xeroth.xeroanticheat.XeroAntiCheat;
import com.xeroth.xeroanticheat.data.PlayerData;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
/**
@@ -125,4 +126,19 @@ public abstract class Check {
|| player.hasPermission("xac.bypass." + getCategory())
|| player.hasPermission("xac.bypass." + name.toLowerCase());
}
protected void setback(Player player, PlayerData data) {
if (!getConfigBoolean("setback", false)) return;
org.bukkit.Location safe = data.getLastSafeLocation();
if (safe == null) return;
data.clearPositionHistory();
player.teleport(safe);
}
protected boolean isServerLagging() {
if (!plugin.getConfigManager().getBoolean("tps.enabled", true)) return false;
double tps = Bukkit.getTPS()[0];
double minTps = plugin.getConfigManager().getDouble("tps.min_tps_threshold", 18.0);
return tps < minTps;
}
}