No chat to show

This project's files are all here to explore.

Files
src
BUG_FIXES.md
pom.xml
README.md
SAFETY_VERIFICATION.md
Code
18 1,473
src/main/java/com/atheronsmp/atheronlore/AtheronLore.java
package com.atheronsmp.atheronlore;

import com.atheronsmp.atheronlore.commands.AtheronLoreCommand;
import com.atheronsmp.atheronlore.commands.ArenaCommand;
import com.atheronsmp.atheronlore.commands.EventRegisterCommand;
import com.atheronsmp.atheronlore.commands.EventWorldCommand;
import com.atheronsmp.atheronlore.listeners.MaceListener;
import com.atheronsmp.atheronlore.listeners.MovementListener;
import com.atheronsmp.atheronlore.listeners.TNTListener;
import com.atheronsmp.atheronlore.managers.ArenaManager;
import com.atheronsmp.atheronlore.managers.ConfigManager;
import com.atheronsmp.atheronlore.managers.EventManager;
import org.bukkit.plugin.java.JavaPlugin;

public class AtheronLore extends JavaPlugin {
    private static AtheronLore instance;
    private ConfigManager configManager;
    private ArenaManager arenaManager;
    private EventManager eventManager;

    @Override
    public void onEnable() {
        instance = this;
        
        try {
            configManager = new ConfigManager(this);
            arenaManager = new ArenaManager(this);
            eventManager = new EventManager(this);

            registerCommands();
            registerListeners();

            getLogger().info("AtheronLore has been enabled!");
        } catch (Exception e) {
            getLogger().severe("Failed to enable AtheronLore: " + e.getMessage());
            e.printStackTrace();
            getServer().getPluginManager().disablePlugin(this);
        }
    }

    @Override
    public void onDisable() {
        try {
            if (arenaManager != null) arenaManager.cancelAll();
            if (eventManager != null) eventManager.cancelAll();
            getLogger().info("AtheronLore has been disabled!");
        } catch (Exception e) {
            getLogger().severe("Error during plugin disable: " + e.getMessage());
        }
    }

    private void registerCommands() {
        getCommand("atheronlore").setExecutor(new AtheronLoreCommand(this));
        
        ArenaCommand arenaCommand = new ArenaCommand(this);
        getCommand("lorearena").setExecutor(arenaCommand);
        getCommand("lorearena").setTabCompleter(arenaCommand);
        
        getCommand("eventregister").setExecutor(new EventRegisterCommand(this));
        
        EventWorldCommand eventWorldCommand = new EventWorldCommand(this);
        getCommand("eventworld").setExecutor(eventWorldCommand);
        getCommand("eventworld").setTabCompleter(eventWorldCommand);
    }

    private void registerListeners() {
        getServer().getPluginManager().registerEvents(new MovementListener(this), this);
        getServer().getPluginManager().registerEvents(new MaceListener(this), this);
        getServer().getPluginManager().registerEvents(new TNTListener(this), this);
    }

    public static AtheronLore getInstance() {
        return instance;
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public ArenaManager getArenaManager() {
        return arenaManager;
    }

    public EventManager getEventManager() {
        return eventManager;
    }
}