Files
src
build.gradle
settings.gradle
Code
14 750
src/main/java/com/kodari/voidboundpets/VoidboundPetsPlugin.java
package com.kodari.voidboundpets;
import com.kodari.voidboundpets.command.PetCommand;
import com.kodari.voidboundpets.listener.PetListener;
import com.kodari.voidboundpets.pet.PetManager;
import com.kodari.voidboundpets.pet.PetSettings;
import com.kodari.voidboundpets.storage.PetStorage;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public final class VoidboundPetsPlugin extends JavaPlugin {
private PetSettings settings;
private PetStorage storage;
private PetManager petManager;
@Override
public void onEnable() {
saveDefaultConfig();
settings = PetSettings.load(getConfig());
storage = new PetStorage(this);
storage.load();
petManager = new PetManager(this, settings, storage);
PetCommand command = new PetCommand(this, petManager, settings);
PluginCommand petCommand = getCommand("voidpet");
if (petCommand != null) {
petCommand.setExecutor(command);
petCommand.setTabCompleter(command);
}
getServer().getPluginManager().registerEvents(new PetListener(petManager), this);
petManager.start();
}
@Override
public void onDisable() {
if (petManager != null) {
petManager.stop();
}
if (storage != null) {
storage.saveAll();
}
}
}