Files
src
build.gradle
settings.gradle
Code
13 840
src/main/java/com/kodari/vortexlifes/VortexLifesPlugin.java
package com.kodari.vortexlifes;
import com.kodari.vortexlifes.command.LifeCommand;
import com.kodari.vortexlifes.data.LifeDataStore;
import com.kodari.vortexlifes.display.DisplayManager;
import com.kodari.vortexlifes.effect.VortexEffect;
import com.kodari.vortexlifes.listener.LifeListener;
import com.kodari.vortexlifes.life.LifeManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public final class VortexLifesPlugin extends JavaPlugin {
private LifeDataStore dataStore;
private DisplayManager displayManager;
private VortexEffect vortexEffect;
private LifeManager lifeManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.dataStore = new LifeDataStore(this);
this.displayManager = new DisplayManager(this);
this.vortexEffect = new VortexEffect(this);
this.lifeManager = new LifeManager(this, dataStore, displayManager, vortexEffect);
Bukkit.getPluginManager().registerEvents(new LifeListener(this), this);
LifeCommand command = new LifeCommand(this);
registerCommand("lives", command);
registerCommand("setlives", command);
registerCommand("addlife", command);
registerCommand("removelife", command);
registerCommand("revive", command);
registerCommand("speciallife", command);
registerCommand("vortex", command);
}
@Override
public void onDisable() {
if (dataStore != null) {
dataStore.save();
}
if (displayManager != null) {
displayManager.clearAll();
}
}
public void reloadPluginConfiguration() {
reloadConfig();
lifeManager.refreshAll();
}
private void registerCommand(String name, LifeCommand command) {
PluginCommand pluginCommand = getCommand(name);
if (pluginCommand != null) {
pluginCommand.setExecutor(command);
pluginCommand.setTabCompleter(command);
}
}
}