Files
src
build.gradle
Code
20 1,464
src/main/java/com/example/dragonheads/DragonHeadsPlugin.java
package com.example.dragonheads;
import com.example.dragonheads.command.DragonCommand;
import com.example.dragonheads.gui.DragonInfoGUI;
import com.example.dragonheads.listener.DragonEntityListener;
import com.example.dragonheads.listener.PlayerInteractListener;
import com.example.dragonheads.listener.PlayerJoinListener;
import com.example.dragonheads.manager.AbilityManager;
import com.example.dragonheads.manager.BondManager;
import com.example.dragonheads.manager.ConfigManager;
import com.example.dragonheads.manager.DataManager;
import com.example.dragonheads.manager.DragonHeadManager;
import com.example.dragonheads.manager.DragonManager;
import com.example.dragonheads.manager.EffectManager;
import com.example.dragonheads.task.DragonTickTask;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class DragonHeadsPlugin extends JavaPlugin {
private ConfigManager configManager;
private DataManager dataManager;
private DragonHeadManager dragonHeadManager;
private DragonManager dragonManager;
private BondManager bondManager;
private AbilityManager abilityManager;
private EffectManager effectManager;
private DragonInfoGUI dragonInfoGUI;
@Override
public void onEnable() {
this.configManager = new ConfigManager(this);
this.dataManager = new DataManager(this);
this.dragonHeadManager = new DragonHeadManager(this);
this.dragonManager = new DragonManager(this);
this.bondManager = new BondManager(this);
this.abilityManager = new AbilityManager(this);
this.effectManager = new EffectManager(this);
this.dragonInfoGUI = new DragonInfoGUI(this);
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerInteractListener(this), this);
getServer().getPluginManager().registerEvents(new DragonEntityListener(this), this);
DragonCommand dragonCommand = new DragonCommand(this);
getCommand("summondragon").setExecutor(dragonCommand);
getCommand("desummondragon").setExecutor(dragonCommand);
getCommand("dragonhead").setExecutor(dragonCommand);
getCommand("dragongive").setExecutor(dragonCommand);
getCommand("dragonbond").setExecutor(dragonCommand);
getCommand("dragoninfo").setExecutor(dragonCommand);
new DragonTickTask(this).runTaskTimer(this, 20L, 20L);
effectManager.runTaskTimer(this, 60L, 60L);
getLogger().info("DragonHeads enabled! 12 dragon colors ready.");
}
@Override
public void onDisable() {
if (dragonManager != null) dragonManager.desummonAll();
if (dataManager != null) dataManager.saveData();
if (effectManager != null && !effectManager.isCancelled()) effectManager.cancel();
getLogger().info("DragonHeads disabled. All dragons dismissed.");
}
}