Files
src
build.gradle
manifest.kod
Code
85 5,355
src/main/java/com/antiaether/AntiAether.java
package com.antiaether;
import com.antiaether.alert.AlertManager;
import com.antiaether.alert.DiscordWebhook;
import com.antiaether.api.AntiAetherAPI;
import com.antiaether.checks.CheckManager;
import com.antiaether.commands.AlertsCommand;
import com.antiaether.commands.AntiAetherCommand;
import com.antiaether.commands.ViolationsCommand;
import com.antiaether.config.ConfigManager;
import com.antiaether.config.Messages;
import com.antiaether.data.PlayerDataManager;
import com.antiaether.inventory.gui.GUIListener;
import com.antiaether.inventory.gui.GUIManager;
import com.antiaether.listeners.CombatListener;
import com.antiaether.listeners.PacketListener;
import com.antiaether.listeners.PlayerListener;
import com.antiaether.punishment.BanwaveManager;
import com.antiaether.punishment.PunishmentManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class AntiAether extends JavaPlugin {
private static AntiAether instance;
private ConfigManager configManager;
private Messages messages;
private PlayerDataManager playerDataManager;
private CheckManager checkManager;
private PunishmentManager punishmentManager;
private BanwaveManager banwaveManager;
private AlertManager alertManager;
private DiscordWebhook discordWebhook;
private GUIManager guiManager;
private AntiAetherAPI api;
@Override
public void onEnable() {
instance = this;
this.configManager = new ConfigManager(this);
this.configManager.loadConfigs();
this.messages = new Messages(this);
this.playerDataManager = new PlayerDataManager();
this.checkManager = new CheckManager(this);
this.punishmentManager = new PunishmentManager(this);
this.banwaveManager = new BanwaveManager(this);
this.alertManager = new AlertManager(this);
this.discordWebhook = new DiscordWebhook(this);
this.guiManager = new GUIManager();
this.api = new AntiAetherAPI(this);
registerListeners();
registerCommands();
this.checkManager.loadChecks();
if (this.configManager.getConfig().getBoolean("settings.auto-banwave")) {
this.banwaveManager.startScheduler();
}
getLogger().info("AntiAether has been enabled!");
getLogger().info("Loaded " + this.checkManager.getChecks().size() + " checks.");
}
@Override
public void onDisable() {
if (this.banwaveManager != null) {
this.banwaveManager.stopScheduler();
}
if (this.checkManager != null) {
this.checkManager.shutdown();
}
getLogger().info("AntiAether has been disabled!");
}
private void registerListeners() {
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
Bukkit.getPluginManager().registerEvents(new CombatListener(this), this);
Bukkit.getPluginManager().registerEvents(new GUIListener(this.guiManager), this);
new PacketListener(this);
}
private void registerCommands() {
getCommand("antiaether").setExecutor(new AntiAetherCommand(this));
getCommand("alerts").setExecutor(new AlertsCommand(this));
ViolationsCommand violationsCommand = new ViolationsCommand(this);
getCommand("violations").setExecutor(violationsCommand);
getCommand("violations").setTabCompleter(violationsCommand);
}
public static AntiAether getInstance() {
return instance;
}
}