Files
src
build.gradle
settings.gradle
Code
15 961
src/main/java/com/kodari/elementalffa/ElementalFFAPlugin.java
package com.kodari.elementalffa;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public final class ElementalFFAPlugin extends JavaPlugin {
private ProfileManager profiles;
private KitManager kits;
private ExpeditionManager expeditions;
private AbilityManager abilities;
@Override
public void onEnable() {
saveDefaultConfig();
profiles = new ProfileManager(this);
kits = new KitManager(this);
expeditions = new ExpeditionManager(this);
abilities = new AbilityManager(this);
getServer().getPluginManager().registerEvents(new ElementalListener(this), this);
ElementalCommand elementalCommand = new ElementalCommand(this);
register("element", elementalCommand, elementalCommand);
register("ability", new AbilityCommand(this), null);
GameCommand gameCommand = new GameCommand(this);
register("kit", gameCommand, null);
register("expedition", gameCommand, null);
register("balance", gameCommand, null);
register("perks", gameCommand, null);
}
private void register(String name, org.bukkit.command.CommandExecutor executor,
org.bukkit.command.TabCompleter completer) {
PluginCommand command = getCommand(name);
if (command == null) {
throw new IllegalStateException("Command is missing from plugin.yml: " + name);
}
command.setExecutor(executor);
if (completer != null) {
command.setTabCompleter(completer);
}
}
@Override
public void onDisable() {
if (expeditions != null) {
expeditions.cancelAll();
}
if (profiles != null) {
profiles.saveAll();
}
}
public ProfileManager getProfiles() {
return profiles;
}
public KitManager getKits() {
return kits;
}
public ExpeditionManager getExpeditions() {
return expeditions;
}
public AbilityManager getAbilities() {
return abilities;
}
}