Files
src
build.gradle
Code
39 2,003
src/main/java/com/aureliatpa/AureliaTPA.java
package com.aureliatpa;
import com.aureliatpa.commands.TpAcceptCommand;
import com.aureliatpa.commands.TpDenyCommand;
import com.aureliatpa.commands.TpaCancelCommand;
import com.aureliatpa.commands.TpaCommand;
import com.aureliatpa.commands.TpaHereCommand;
import com.aureliatpa.commands.TpaIgnoreCommand;
import com.aureliatpa.commands.TpaListCommand;
import com.aureliatpa.commands.TpaReloadCommand;
import com.aureliatpa.commands.TpaSpyCommand;
import com.aureliatpa.commands.TpaToggleCommand;
import com.aureliatpa.config.ConfigManager;
import com.aureliatpa.inventory.gui.GUIListener;
import com.aureliatpa.inventory.gui.GUIManager;
import com.aureliatpa.listener.PlayerListener;
import com.aureliatpa.manager.CooldownManager;
import com.aureliatpa.manager.IgnoreManager;
import com.aureliatpa.manager.SpyManager;
import com.aureliatpa.manager.TPAManager;
import com.aureliatpa.manager.TeleportManager;
import com.aureliatpa.manager.ToggleManager;
import com.aureliatpa.placeholder.TPAPlaceholders;
import com.aureliatpa.util.ActionBarUtil;
import com.aureliatpa.util.BossBarUtil;
import com.aureliatpa.util.MessageUtil;
import com.aureliatpa.util.SoundUtil;
import com.aureliatpa.util.VersionUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.plugin.java.JavaPlugin;
public class AureliaTPA extends JavaPlugin {
private ConfigManager configManager;
private MessageUtil messageUtil;
private ActionBarUtil actionBarUtil;
private BossBarUtil bossBarUtil;
private SoundUtil soundUtil;
private TPAManager tpaManager;
private CooldownManager cooldownManager;
private ToggleManager toggleManager;
private IgnoreManager ignoreManager;
private SpyManager spyManager;
private TeleportManager teleportManager;
private GUIManager guiManager;
@Override
public void onEnable() {
this.configManager = new ConfigManager(this);
this.messageUtil = new MessageUtil(this);
this.actionBarUtil = new ActionBarUtil();
this.bossBarUtil = new BossBarUtil();
this.soundUtil = new SoundUtil(this);
this.tpaManager = new TPAManager(this);
this.cooldownManager = new CooldownManager();
this.toggleManager = new ToggleManager();
this.ignoreManager = new IgnoreManager();
this.spyManager = new SpyManager();
this.teleportManager = new TeleportManager(this);
this.guiManager = new GUIManager();
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
registerCommand("tpa", new TpaCommand(this));
registerCommand("tpahere", new TpaHereCommand(this));
registerCommand("tpaccept", new TpAcceptCommand(this));
registerCommand("tpdeny", new TpDenyCommand(this));
registerCommand("tpalist", new TpaListCommand(this));
registerCommand("tpacancel", new TpaCancelCommand(this));
registerCommand("tpatoggle", new TpaToggleCommand(this));
registerCommand("tpareload", new TpaReloadCommand(this));
registerCommand("tpaignore", new TpaIgnoreCommand(this));
registerCommand("tpaspy", new TpaSpyCommand(this));
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
new TPAPlaceholders(this).register();
}
getLogger().info("AureliaTPA has been enabled. Detected server version: 1." + VersionUtil.getMinorVersion() + ".x");
}
@Override
public void onDisable() {
getLogger().info("AureliaTPA has been disabled.");
}
private void registerCommand(String name, CommandExecutor executor) {
PluginCommand command = getCommand(name);
if (command != null) {
command.setExecutor(executor);
if (executor instanceof TabCompleter) {
command.setTabCompleter((TabCompleter) executor);
}
}
}
public ConfigManager getConfigManager() {
return configManager;
}
public MessageUtil getMessageUtil() {
return messageUtil;
}
public ActionBarUtil getActionBarUtil() {
return actionBarUtil;
}
public BossBarUtil getBossBarUtil() {
return bossBarUtil;
}
public SoundUtil getSoundUtil() {
return soundUtil;
}
public TPAManager getTpaManager() {
return tpaManager;
}
public CooldownManager getCooldownManager() {
return cooldownManager;
}
public ToggleManager getToggleManager() {
return toggleManager;
}
public IgnoreManager getIgnoreManager() {
return ignoreManager;
}
public SpyManager getSpyManager() {
return spyManager;
}
public TeleportManager getTeleportManager() {
return teleportManager;
}
public GUIManager getGuiManager() {
return guiManager;
}
}