rockt0282

what is wrong with the coad it won't work as a plugin on minehut

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
36 2,348
src/main/java/com/mythicrealms/MythicRealms.java
package com.mythicrealms;

import com.mythicrealms.config.ConfigManager;
import com.mythicrealms.managers.CustomItemManager;
import com.mythicrealms.managers.PlayerDataManager;
import com.mythicrealms.modules.armor.ArmorListener;
import com.mythicrealms.modules.backpack.BackpackListener;
import com.mythicrealms.modules.boss.BossModule;
import com.mythicrealms.modules.dragon.DragonModule;
import com.mythicrealms.modules.golem.GolemListener;
import com.mythicrealms.modules.ores.OreModule;
import com.mythicrealms.modules.performance.PerformanceModule;
import com.mythicrealms.modules.stats.PlayerStatsModule;
import com.mythicrealms.modules.teleport.TeleportCommand;
import com.mythicrealms.modules.teleport.TeleportModule;
import com.mythicrealms.modules.tools.ToolListener;
import com.mythicrealms.modules.tools.VeinMinerListener;
import com.mythicrealms.modules.weapon.WeaponListener;
import lombok.Getter;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class MythicRealms extends JavaPlugin {
    
    private ConfigManager configManager;
    private PlayerDataManager playerDataManager;
    private CustomItemManager customItemManager;
    
    private BossModule bossModule;
    private OreModule oreModule;
    private DragonModule dragonModule;
    private PlayerStatsModule playerStatsModule;
    private TeleportModule teleportModule;
    private PerformanceModule performanceModule;
    
    public NamespacedKey getKey(String key) {
        return new NamespacedKey(this, key);
    }
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        this.playerDataManager = new PlayerDataManager(this);
        this.customItemManager = new CustomItemManager(this);
        
        registerModules();
        registerCommands();
        registerListeners();
        
        getLogger().info("MythicRealms has been enabled!");
        getLogger().info("Loaded with custom bosses, End content, and enhanced mechanics.");
    }
    
    @Override
    public void onDisable() {
        if (playerDataManager != null) {
            playerDataManager.saveAll();
        }
        
        if (dragonModule != null) {
            dragonModule.shutdown();
        }
        
        if (performanceModule != null) {
            performanceModule.shutdown();
        }
        
        getLogger().info("MythicRealms has been disabled!");
    }
    
    private void registerModules() {
        if (configManager.isFeatureEnabled("bosses")) {
            this.bossModule = new BossModule(this);
            bossModule.initialize();
        }
        
        if (configManager.isFeatureEnabled("end-ores")) {
            this.oreModule = new OreModule(this);
            oreModule.initialize();
        }
        
        if (configManager.isFeatureEnabled("stronger-dragon") || configManager.isFeatureEnabled("dragon-hatching")) {
            this.dragonModule = new DragonModule(this);
            dragonModule.initialize();
        }
        
        if (configManager.isFeatureEnabled("player-stats")) {
            this.playerStatsModule = new PlayerStatsModule(this);
            playerStatsModule.initialize();
        }
        
        if (configManager.isFeatureEnabled("tpa")) {
            this.teleportModule = new TeleportModule(this);
        }
        
        if (configManager.isFeatureEnabled("performance-optimizations")) {
            this.performanceModule = new PerformanceModule(this);
            performanceModule.initialize();
        }
    }
    
    private void registerCommands() {
        getCommand("mythicrealms").setExecutor(new MainCommand(this));
        
        if (teleportModule != null) {
            TeleportCommand tpCmd = new TeleportCommand(this, teleportModule);
            getCommand("tpa").setExecutor(tpCmd);
            getCommand("tpaccept").setExecutor(tpCmd);
            getCommand("tpdeny").setExecutor(tpCmd);
        }
        
        if (dragonModule != null) {
            getCommand("dragonhatch").setExecutor(new DragonHatchCommand(this, dragonModule));
            getCommand("spawnboss").setExecutor(new SpawnBossCommand(this, bossModule));
        }
    }
    
    private void registerListeners() {
        if (configManager.isFeatureEnabled("ender-armor")) {
            getServer().getPluginManager().registerEvents(new ArmorListener(this), this);
        }
        
        if (configManager.isFeatureEnabled("ender-weapons") || configManager.isFeatureEnabled("custom-weapons")) {
            getServer().getPluginManager().registerEvents(new WeaponListener(this), this);
        }
        
        if (configManager.isFeatureEnabled("enhanced-golems")) {
            getServer().getPluginManager().registerEvents(new GolemListener(this), this);
        }
        
        if (configManager.isFeatureEnabled("custom-weapons")) {
            getServer().getPluginManager().registerEvents(new ToolListener(this), this);
            getServer().getPluginManager().registerEvents(new VeinMinerListener(this), this);
        }
        
        if (configManager.isFeatureEnabled("backpacks")) {
            getServer().getPluginManager().registerEvents(new BackpackListener(this), this);
        }
    }
    
    public void reload() {
        reloadConfig();
        configManager = new ConfigManager(this);
    }
}