Initial BungeeCord edition
This commit is contained in:
parent
4416d55173
commit
23e8e80191
75 changed files with 1931 additions and 396 deletions
|
|
@ -0,0 +1,65 @@
|
|||
package net.frankheijden.serverutils.bungee;
|
||||
|
||||
import co.aikar.commands.BungeeCommandCompletionContext;
|
||||
import co.aikar.commands.BungeeCommandManager;
|
||||
import co.aikar.commands.CommandCompletions;
|
||||
import net.frankheijden.serverutils.bungee.commands.CommandPlugins;
|
||||
import net.frankheijden.serverutils.bungee.commands.CommandServerUtils;
|
||||
import net.frankheijden.serverutils.bungee.entities.BungeePlugin;
|
||||
import net.frankheijden.serverutils.bungee.entities.BungeeReflection;
|
||||
import net.frankheijden.serverutils.common.ServerUtilsApp;
|
||||
import net.frankheijden.serverutils.common.config.Config;
|
||||
import net.frankheijden.serverutils.common.config.Messenger;
|
||||
import net.frankheijden.serverutils.common.providers.PluginProvider;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import org.bstats.bungeecord.Metrics;
|
||||
|
||||
public class ServerUtils extends Plugin {
|
||||
|
||||
private static ServerUtils instance;
|
||||
private static final String CONFIG_RESOURCE = "bungee-config.yml";
|
||||
private static final String MESSAGES_RESOURCE = "bungee-messages.yml";
|
||||
|
||||
private BungeePlugin plugin;
|
||||
private BungeeCommandManager commandManager;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
instance = this;
|
||||
|
||||
this.plugin = new BungeePlugin(this);
|
||||
ServerUtilsApp.init(plugin);
|
||||
|
||||
new Metrics(this, ServerUtilsApp.BSTATS_METRICS_ID);
|
||||
new BungeeReflection();
|
||||
|
||||
this.commandManager = new BungeeCommandManager(this);
|
||||
commandManager.registerCommand(new CommandPlugins());
|
||||
commandManager.registerCommand(new CommandServerUtils());
|
||||
|
||||
PluginProvider<Plugin> provider = plugin.getPluginProvider();
|
||||
CommandCompletions<BungeeCommandCompletionContext> commandCompletions = commandManager.getCommandCompletions();
|
||||
commandCompletions.registerAsyncCompletion("plugins", context -> provider.getPluginNames());
|
||||
commandCompletions.registerAsyncCompletion("pluginJars", context -> provider.getPluginFileNames());
|
||||
|
||||
reload();
|
||||
}
|
||||
|
||||
public static ServerUtils getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public BungeePlugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public BungeeCommandManager getCommandManager() {
|
||||
return commandManager;
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
new Config("config.yml", CONFIG_RESOURCE);
|
||||
new Messenger("messages.yml", MESSAGES_RESOURCE);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue