Files
src
build.gradle
manifest.kod
Code
29 1,827
src/main/java/com/tox/anticheat/TOXAntiCheat.java
package com.tox.anticheat;
import com.tox.anticheat.alert.AlertManager;
import com.tox.anticheat.checks.CheckRegistry;
import com.tox.anticheat.command.TOXCommand;
import com.tox.anticheat.data.PlayerDataManager;
import com.tox.anticheat.detection.HeuristicEngine;
import com.tox.anticheat.detection.PredictionEngine;
import com.tox.anticheat.packet.PacketListener;
import com.tox.anticheat.punish.PunishmentManager;
import com.tox.anticheat.util.EncryptionUtil;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class TOXAntiCheat extends JavaPlugin {
@Getter
private static TOXAntiCheat instance;
private PlayerDataManager playerDataManager;
private CheckRegistry checkRegistry;
private HeuristicEngine heuristicEngine;
private PredictionEngine predictionEngine;
private AlertManager alertManager;
private PunishmentManager punishmentManager;
private PacketListener packetListener;
@Override
public void onEnable() {
instance = this;
long startTime = System.currentTimeMillis();
saveDefaultConfig();
if (getConfig().getBoolean("encryption.enabled")) {
EncryptionUtil.initialize();
}
initializeComponents();
registerListeners();
registerCommands();
long loadTime = System.currentTimeMillis() - startTime;
getLogger().info("╔══════════════════════════════════════╗");
getLogger().info("║ TOX AntiCheat Enterprise Edition ║");
getLogger().info("║ Advanced Protection ║");
getLogger().info("╚══════════════════════════════════════╝");
getLogger().info("Loaded in " + loadTime + "ms with " + checkRegistry.getCheckCount() + " detection modules");
getLogger().info("ML Mode: " + (getConfig().getBoolean("detection.machine-learning-mode") ? "ENABLED" : "DISABLED"));
getLogger().info("Encryption: " + (getConfig().getBoolean("encryption.enabled") ? "ACTIVE" : "INACTIVE"));
}
@Override
public void onDisable() {
if (playerDataManager != null) {
playerDataManager.shutdown();
}
if (heuristicEngine != null) {
heuristicEngine.shutdown();
}
getLogger().info("TOX AntiCheat disabled - All data saved");
}
private void initializeComponents() {
this.playerDataManager = new PlayerDataManager(this);
this.checkRegistry = new CheckRegistry(this);
this.heuristicEngine = new HeuristicEngine(this);
this.predictionEngine = new PredictionEngine(this);
this.alertManager = new AlertManager(this);
this.punishmentManager = new PunishmentManager(this);
checkRegistry.registerAllChecks();
}
private void registerListeners() {
this.packetListener = new PacketListener(this);
getServer().getPluginManager().registerEvents(packetListener, this);
getServer().getPluginManager().registerEvents(playerDataManager, this);
}
private void registerCommands() {
getCommand("tox").setExecutor(new TOXCommand(this));
}
public void reload() {
reloadConfig();
checkRegistry.reloadChecks();
getLogger().info("Configuration reloaded");
}
}