Files
src
build.gradle
IMPORTANT.txt
manifest.kod
Code
20 2,092
src/main/java/com/tsgod/advancedanticheat/AdvanceAntiCheat.java
package com.tsgod.advancedanticheat;
import com.tsgod.advancedanticheat.commands.AntiCheatCommand;
import com.tsgod.advancedanticheat.listeners.BlockBreakListener;
import com.tsgod.advancedanticheat.listeners.PlayerJoinListener;
import com.tsgod.advancedanticheat.listeners.ResourcePackListener;
import com.tsgod.advancedanticheat.managers.BlockObfuscationManager;
import com.tsgod.advancedanticheat.managers.ClientDataManager;
import com.tsgod.advancedanticheat.managers.CloudStorageManager;
import com.tsgod.advancedanticheat.managers.DataStorageManager;
import com.tsgod.advancedanticheat.managers.XRayDetectionManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class AdvanceAntiCheat extends JavaPlugin {
private XRayDetectionManager detectionManager;
private BlockObfuscationManager obfuscationManager;
private DataStorageManager dataManager;
private CloudStorageManager cloudManager;
private ClientDataManager clientDataManager;
@Override
public void onEnable() {
saveDefaultConfig();
initializeManagers();
registerListeners();
registerCommands();
startScheduledTasks();
getLogger().info("AdvanceAntiCheat v1.0.0 by TSGOD has been enabled!");
getLogger().info("X-Ray detection and block obfuscation active.");
getLogger().info("Client data tracking enabled - monitoring resource packs, mods, and data packs.");
}
@Override
public void onDisable() {
if (obfuscationManager != null) {
obfuscationManager.shutdown();
}
if (dataManager != null) {
dataManager.saveAll();
}
if (clientDataManager != null) {
clientDataManager.saveAll();
}
if (cloudManager != null && getConfig().getBoolean("cloud-storage.enabled")) {
cloudManager.uploadAllPendingData();
}
getLogger().info("AdvanceAntiCheat has been disabled. All data saved.");
}
private void initializeManagers() {
this.detectionManager = new XRayDetectionManager(this);
this.obfuscationManager = new BlockObfuscationManager(this);
this.dataManager = new DataStorageManager(this);
this.cloudManager = new CloudStorageManager(this);
this.clientDataManager = new ClientDataManager(this);
}
private void registerListeners() {
getServer().getPluginManager().registerEvents(new BlockBreakListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
getServer().getPluginManager().registerEvents(new ResourcePackListener(this), this);
}
private void registerCommands() {
getCommand("anticheat").setExecutor(new AntiCheatCommand(this));
}
private void startScheduledTasks() {
long saveInterval = getConfig().getLong("data.save-interval", 60) * 20L;
getServer().getScheduler().runTaskTimerAsynchronously(this, () -> {
dataManager.saveAll();
clientDataManager.saveAll();
}, saveInterval, saveInterval);
if (getConfig().getBoolean("cloud-storage.enabled") && getConfig().getBoolean("cloud-storage.auto-upload")) {
long uploadInterval = getConfig().getLong("cloud-storage.upload-interval", 300) * 20L;
getServer().getScheduler().runTaskTimerAsynchronously(this, () -> {
cloudManager.uploadAllPendingData();
}, uploadInterval, uploadInterval);
}
long updateInterval = getConfig().getLong("obfuscation.update-interval", 20) * 20L;
getServer().getScheduler().runTaskTimer(this, () -> {
obfuscationManager.updateAllObfuscations();
}, updateInterval, updateInterval);
}
}