Merge branch '13.4'

This commit is contained in:
2022-11-15 02:19:36 +01:00
28 changed files with 959 additions and 284 deletions

View File

@@ -10,12 +10,15 @@ import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.bstats.Metrics;
import net.t2code.t2codelib.SPIGOT.system.cmd.CmdExecuter;
import net.t2code.t2codelib.SPIGOT.system.cmd.ReportLogStorage;
import net.t2code.t2codelib.SPIGOT.system.config.config.ConfigCreate;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import net.t2code.t2codelib.SPIGOT.system.config.languages.LanguagesCreate;
import net.t2code.t2codelib.SPIGOT.system.config.languages.SelectLibMsg;
import net.t2code.t2codelib.Util;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@@ -30,7 +33,7 @@ public final class T2CodeLibMain extends JavaPlugin {
private static List<String> autor;
private static String version;
private static Boolean nmIsLoad = true;
private static Boolean mmIsLoad = true;
private static Boolean load = false;
@Override
@@ -39,7 +42,11 @@ public final class T2CodeLibMain extends JavaPlugin {
plugin = this;
autor = plugin.getDescription().getAuthors();
version = plugin.getDescription().getVersion();
this.adventure = BukkitAudiences.create(this);
try {
adventure = BukkitAudiences.create(this);
} catch (Exception e) {
mmIsLoad = false;
}
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
String prefix = Util.getPrefix();
@@ -56,10 +63,12 @@ public final class T2CodeLibMain extends JavaPlugin {
T2Csend.warning(plugin, "The 1.20.* is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
T2Csend.console(prefix);
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
if (!SelectLibConfig.getT2cTestDevelopment()) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
T2Csend.console(prefix + " §3Server run on: §6" + T2CmcVersion.getMcVersion() + " / " + T2CmcVersion.getNms());
@@ -90,13 +99,16 @@ public final class T2CodeLibMain extends JavaPlugin {
SelectLibConfig.onSelect();
SelectLibMsg.onSelect();
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getSpigotID(), Util.getDiscord());
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(), SelectLibConfig.getUpdateCheckOnJoin(), SelectLibConfig.getSeePreReleaseUpdates(),
SelectLibConfig.getUpdateCheckTimeInterval());
Metrics.Bstats(plugin, Util.getBstatsID());
if (SelectLibConfig.getBungee()){
if (SelectLibConfig.getBungee()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
}
ReportLogStorage.load();
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
checkIsBungee();
T2Ctemplate.onLoadFooter(prefix, long_);
load = true;
}
@@ -105,6 +117,7 @@ public final class T2CodeLibMain extends JavaPlugin {
public void onDisable() {
// Plugin shutdown logic
if (!load) return;
ReportLogStorage.save();
if (SelectLibConfig.getInventoriesCloseByServerStop()) {
for (Player player : Bukkit.getOnlinePlayers()) {
player.closeInventory();
@@ -113,7 +126,7 @@ public final class T2CodeLibMain extends JavaPlugin {
Vault.vaultDisable();
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
if (nmIsLoad) {
if (mmIsLoad) {
if (this.adventure != null) {
this.adventure.close();
this.adventure = null;
@@ -155,14 +168,27 @@ public final class T2CodeLibMain extends JavaPlugin {
private static BukkitAudiences adventure;
public static BukkitAudiences adventure() {
public BukkitAudiences getAdventure() {
if (adventure == null) {
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
}
return adventure;
}
public static Boolean getNmIsLoad() {
return nmIsLoad;
private static void checkIsBungee() {
File config = new File("spigot.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
isBungee = yamlConfiguration.getBoolean("settings.bungeecord");
}
private static Boolean isBungee;
public static Boolean getIsBungee() {
return isBungee;
}
public static Boolean getMmIsLoad() {
return mmIsLoad;
}
}