Essentia/plugin/src/main/java/com/alttd/essentia/EssentiaPlugin.java
Len 1669a114bc Essentia plugin
Basic plugin with some essential utilities and commands.
2024-02-03 21:58:02 +01:00

68 lines
2.4 KiB
Java

package com.alttd.essentia;
import com.alttd.essentia.commands.admin.*;
import com.alttd.essentia.commands.player.*;
import com.alttd.essentia.configuration.Config;
import com.alttd.essentia.listeners.PlayerListener;
import lombok.Getter;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.slf4j.Logger;
import java.nio.file.Path;
public class EssentiaPlugin extends JavaPlugin implements EssentiaAPI {
@Getter
private static EssentiaPlugin instance;
@Override
public void onLoad() {
instance = this;
EssentiaAPI.Provider.register(instance);
}
@Override
public void onEnable() {
loadConfiguration();
loadCommands();
loadEventListeners();
}
@Override
public void onDisable() {
getServer().getScheduler().cancelTasks(this);
}
public void loadConfiguration() {
Config.init();
}
public void loadCommands() {
getCommand("essentia").setExecutor(new EssentiaCommand(this));
getCommand("teleportaccept").setExecutor(new TeleportAcceptCommand(this));
getCommand("teleportdeny").setExecutor(new TeleportDenyCommand(this));
getCommand("teleportrequest").setExecutor(new TeleportRequestCommand(this));
getCommand("teleportrequesthere").setExecutor(new TeleportRequestHereCommand(this));
getCommand("teleporttoggle").setExecutor(new TeleportToggleCommand(this));
getCommand("clearinventory").setExecutor(new ClearInventoryCommand(this));
getCommand("home").setExecutor(new HomeCommand(this));
getCommand("homes").setExecutor(new HomeListCommand(this));
getCommand("sethome").setExecutor(new SetHomeCommand(this));
getCommand("deletehome").setExecutor(new DelHomeCommand(this));
getCommand("back").setExecutor(new BackCommand(this));
getCommand("deathback").setExecutor(new DeathBackCommand(this));
getCommand("fly").setExecutor(new FlyCommand(this));
getCommand("gamemode").setExecutor(new GamemodeCommand(this));
getCommand("heal").setExecutor(new HealCommand(this));
getCommand("feed").setExecutor(new FeedCommand(this));
getCommand("enchant").setExecutor(new EnchantCommand(this));
}
public void loadEventListeners() {
final PluginManager pluginManager = getServer().getPluginManager();
pluginManager.registerEvents(new PlayerListener(this), this);
}
}