Files
src
build.gradle
Code
45 3,687
src/main/java/com/mythicalrealms/plugin/MythicalRealms.java
package com.mythicalrealms.plugin;
import com.mythicalrealms.plugin.bosses.BossManager;
import com.mythicalrealms.plugin.commands.MythicalCommand;
import com.mythicalrealms.plugin.config.ConfigManager;
import com.mythicalrealms.plugin.dimension.DimensionManager;
import com.mythicalrealms.plugin.items.ItemManager;
import com.mythicalrealms.plugin.listeners.*;
import com.mythicalrealms.plugin.listeners.BossSummonListener;
import com.mythicalrealms.plugin.listeners.OreListener;
import com.mythicalrealms.plugin.mobs.MobManager;
import com.mythicalrealms.plugin.ores.OreManager;
import com.mythicalrealms.plugin.structures.StructureManager;
import com.mythicalrealms.plugin.crafting.RecipeManager;
import com.mythicalrealms.plugin.materials.MaterialManager;
import com.mythicalrealms.plugin.portal.PortalManager;
import com.mythicalrealms.plugin.spawning.MobSpawner;
import com.mythicalrealms.plugin.spawning.StructureSpawner;
import com.mythicalrealms.plugin.items.ArmorSetManager;
import com.mythicalrealms.plugin.progression.ProgressionManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class MythicalRealms extends JavaPlugin {
private ConfigManager configManager;
private MobManager mobManager;
private BossManager bossManager;
private ItemManager itemManager;
private DimensionManager dimensionManager;
private OreManager oreManager;
private StructureManager structureManager;
private MaterialManager materialManager;
private RecipeManager recipeManager;
private PortalManager portalManager;
private ArmorSetManager armorSetManager;
private MobSpawner mobSpawner;
private StructureSpawner structureSpawner;
private ProgressionManager progressionManager;
@Override
public void onEnable() {
this.getLogger().info("Initializing MythicalRealms...");
this.initializeManagers();
this.registerListeners();
this.registerCommands();
this.getLogger().info("MythicalRealms has been enabled!");
}
@Override
public void onDisable() {
if (this.bossManager != null) {
this.bossManager.removeAllBosses();
}
if (this.mobSpawner != null) {
this.mobSpawner.stopSpawning();
}
if (this.recipeManager != null) {
this.recipeManager.unregisterRecipes();
}
this.getLogger().info("MythicalRealms has been disabled!");
}
private void initializeManagers() {
this.configManager = new ConfigManager(this);
this.configManager.loadConfigs();
this.materialManager = new MaterialManager(this);
this.materialManager.loadMaterials();
this.itemManager = new ItemManager(this);
this.itemManager.loadItems();
this.mobManager = new MobManager(this);
this.mobManager.loadMobs();
this.bossManager = new BossManager(this);
this.bossManager.loadBosses();
this.dimensionManager = new DimensionManager(this);
this.dimensionManager.initialize();
this.oreManager = new OreManager(this);
this.oreManager.loadOres();
this.structureManager = new StructureManager(this);
this.structureManager.loadStructures();
this.recipeManager = new RecipeManager(this);
this.recipeManager.loadRecipes();
this.portalManager = new PortalManager(this);
this.armorSetManager = new ArmorSetManager(this);
this.mobSpawner = new MobSpawner(this);
this.mobSpawner.startSpawning();
this.structureSpawner = new StructureSpawner(this);
this.progressionManager = new ProgressionManager(this);
}
private void registerListeners() {
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new MobListener(this), this);
pm.registerEvents(new BossListener(this), this);
pm.registerEvents(new ArmorListener(this), this);
pm.registerEvents(new ItemListener(this), this);
pm.registerEvents(new DimensionListener(this), this);
pm.registerEvents(new PortalListener(this), this);
pm.registerEvents(new CraftingListener(this), this);
pm.registerEvents(this.structureSpawner, this);
}
private void registerCommands() {
this.getCommand("mythicalrealms").setExecutor(new MythicalCommand(this));
}
}