T2CodeLib/src/main/java/net/t2code/t2codelib/BUNGEE/system/T2CBload.java

66 lines
3.1 KiB
Java

package net.t2code.t2codelib.BUNGEE.system;
import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CBmetrics;
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CBbungeePlayers;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.T2CplmsgBcmd;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse.T2CapiAutoResponse;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUI;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.opSecurity.T2CapiOpSecurity;
import java.io.IOException;
public class T2CBload {
public static void onLoad(Plugin plugin, String prefix, String autor, String version, String spigot, String discord, Integer spigotID, Integer bstatsID, String url) {
long long_ = System.currentTimeMillis();
T2CBsend.console(prefix + "§4============================= " + prefix + " §4=============================");
T2CBsend.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
T2CBsend.console(prefix + " §2Version: §6" + version);
T2CBsend.console(prefix + " §2Spigot: §6" + spigot);
T2CBsend.console(prefix + " §2Discord: §6" + discord);
T2CBmetrics.Bstats(plugin, bstatsID);
try {
T2CBlibConfig.create();
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
T2CBlibConfig.select();
} catch (IOException e) {
throw new RuntimeException(e);
}
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);
//API
plugin.getProxy().registerChannel("t2c:bcmd");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CplmsgBcmd());
plugin.getProxy().registerChannel("t2c:bonlp");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CBbungeePlayers());
T2CBbungeePlayers.sendToSpigotDeleteAll();
if (T2CBlibConfig.getApiCommandGUIEnable()) {
plugin.getProxy().registerChannel("t2c:cguiopl");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiCGUI());
T2CapiCGUI.sendToSpigotDeleteAll();
}
if (T2CBlibConfig.getApiAutoResponse()) {
plugin.getProxy().registerChannel("t2c:aresp");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiAutoResponse());
}
if (T2CBlibConfig.getApiOpSecurity()) {
plugin.getProxy().registerChannel("t2c:t2c:opsec");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiOpSecurity());
}
T2CBsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2CBsend.console(prefix + "§4============================= " + prefix + " §4=============================");
}
}