Files
src
build.gradle
manifest.kod
Code
43 1,933
src/main/java/com/leyla/anticheat/LeylaAntiCheat.java
package com.leyla.anticheat;
import com.leyla.anticheat.check.CheckManager;
import com.leyla.anticheat.command.LeylaCommand;
import com.leyla.anticheat.config.ConfigManager;
import com.leyla.anticheat.data.DataManager;
import com.leyla.anticheat.data.ViolationManager;
import com.leyla.anticheat.inventory.gui.GUIListener;
import com.leyla.anticheat.inventory.gui.GUIManager;
import com.leyla.anticheat.listener.PacketListener;
import com.leyla.anticheat.listener.PlayerListener;
import com.leyla.anticheat.punishment.PunishmentManager;
import com.leyla.anticheat.util.AlertManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class LeylaAntiCheat extends JavaPlugin {
private ConfigManager configManager;
private CheckManager checkManager;
private ViolationManager violationManager;
private PunishmentManager punishmentManager;
private AlertManager alertManager;
private GUIManager guiManager;
private DataManager dataManager;
@Override
public void onEnable() {
this.configManager = new ConfigManager(this);
this.configManager.loadConfigs();
this.dataManager = new DataManager(this);
this.dataManager.initialize();
this.violationManager = new ViolationManager();
this.punishmentManager = new PunishmentManager(this);
this.alertManager = new AlertManager(this);
this.checkManager = new CheckManager(this);
this.guiManager = new GUIManager();
this.checkManager.registerChecks();
registerListeners();
registerCommands();
getLogger().info("Leyla AntiCheat has been enabled!");
getLogger().info("Version: " + getDescription().getVersion());
}
@Override
public void onDisable() {
if (this.dataManager != null) {
this.dataManager.shutdown();
}
getLogger().info("Leyla AntiCheat has been disabled!");
}
private void registerListeners() {
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
Bukkit.getPluginManager().registerEvents(new PacketListener(this), this);
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
}
private void registerCommands() {
getCommand("leyla").setExecutor(new LeylaCommand(this));
}
public void reload() {
this.configManager.loadConfigs();
this.checkManager.reloadChecks();
getLogger().info("Configuration reloaded!");
}
}