13.4_SNAPSHOT-1

This commit is contained in:
2022-11-14 18:45:54 +01:00
parent f70767b361
commit f9b0b512b9
18 changed files with 222 additions and 103 deletions

View File

@@ -1,5 +1,7 @@
package net.t2code.t2codelib.BUNGEE.system;
import lombok.NonNull;
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.t2codelib.Util;
@@ -16,6 +18,16 @@ public class T2CodeBMain extends Plugin {
private static String orgVersion;
private static String autor;
private static Boolean mmIsLoad = true;
private static BungeeAudiences adventure;
public static BungeeAudiences getAdventure() {
if(adventure == null) {
throw new IllegalStateException("Cannot retrieve audience provider while plugin is not enabled");
}
return adventure;
}
@Override
public void onEnable() {
@@ -23,6 +35,11 @@ public class T2CodeBMain extends Plugin {
plugin = this;
orgVersion = plugin.getDescription().getVersion();
autor = plugin.getDescription().getAuthor();
try {
adventure = BungeeAudiences.create(this);
} catch (Exception e){
mmIsLoad = false;
}
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
String[] fv = orgVersion.split("_");
plugin.getDescription().setVersion(fv[0]);
@@ -32,6 +49,12 @@ public class T2CodeBMain extends Plugin {
@Override
public void onDisable() {
// Plugin shutdown logic
if (mmIsLoad){
if(adventure != null) {
adventure.close();
adventure = null;
}
}
T2CBsend.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
T2CBsend.console(Util.getPrefix() + " §2Autor: §6" + String.valueOf(plugin.getDescription().getAuthor()).replace("[", "").replace("]", ""));
T2CBsend.console(Util.getPrefix() + " §2Version: §6" + version);
@@ -40,4 +63,7 @@ public class T2CodeBMain extends Plugin {
T2CBsend.console(Util.getPrefix() + " §4Plugin successfully disabled.");
T2CBsend.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
}
public static Boolean getMmIsLoad() {
return mmIsLoad;
}
}