Files
src
build.gradle
settings.gradle
Code
23 1,549
src/main/java/com/ashhollow/magic/AshhollowMagic.java
package com.ashhollow.magic;
import com.ashhollow.magic.command.MagicCommand;
import com.ashhollow.magic.data.MagicStorage;
import com.ashhollow.magic.gui.GUIListener;
import com.ashhollow.magic.gui.GUIManager;
import com.ashhollow.magic.kingdom.AshhollowMagicApi;
import com.ashhollow.magic.listener.MagicListener;
import com.ashhollow.magic.service.MagicService;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class AshhollowMagic extends JavaPlugin {
private MagicStorage storage;
private MagicService magicService;
private GUIManager guiManager;
private AshhollowMagicApi api;
@Override
public void onEnable() {
saveDefaultConfig();
this.storage = new MagicStorage(this);
this.magicService = new MagicService(this, storage);
this.guiManager = new GUIManager();
this.api = new AshhollowMagicApi(magicService);
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
Bukkit.getPluginManager().registerEvents(new MagicListener(this, magicService, guiManager), this);
MagicCommand magicCommand = new MagicCommand(this, magicService, guiManager);
getCommand("magic").setExecutor(magicCommand);
getCommand("magic").setTabCompleter(magicCommand);
Bukkit.getScheduler().runTaskTimer(this, () -> {
Bukkit.getOnlinePlayers().forEach(magicService::applyPassiveEffects);
}, 20L, 100L);
}
@Override
public void onDisable() {
if (storage != null) {
storage.saveAll();
}
}
public MagicService getMagicService() {
return magicService;
}
public AshhollowMagicApi getApi() {
return api;
}
}