final 13.0 & 13.1

13.1:
add by Commands "!asConsole" & "!onBungee"
This commit is contained in:
2022-11-03 07:57:53 +01:00
parent 667ff81357
commit 176e9724e7
24 changed files with 318 additions and 94 deletions

View File

@@ -70,28 +70,28 @@ public class T2CupdateAPI {
public static void sendUpdateMsg(String prefix, Integer spigot, String discord, Plugin plugin) {
String publicVersion = pluginVersions.get(plugin.getName()).publicVersion;
String pluginVersion = plugin.getDescription().getVersion();
T2Csend.console("§4=========== " + prefix + " §4===========");
String h = "§4=========== " + prefix + " §4===========";
String s1 = "";
String s2 = "§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion;
String s3 = "§6You can download it here: §ehttps://www.spigotmc.org/resources/" + spigot;
String s4 = "§6You can find more information on Discord: §e" + discord;
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")) {
if (publicVersion.toLowerCase().contains("dev")) {
T2Csend.console("§6A new §4DEV§6 version was found!");
s1 = "§6A new §4DEV§6 version was found!§r";
}
if (publicVersion.toLowerCase().contains("beta")) {
T2Csend.console("§6A new §2BETA§6 version was found!");
s1 = "§6A new §2BETA§6 version was found!§r";
}
if (publicVersion.toLowerCase().contains("snapshot")) {
T2Csend.console("§6A new §eSNAPSHOT§6 version was found!");
s1 = "§6A new §eSNAPSHOT§6 version was found!§r";
}
} else {
T2Csend.console("§6A new version was found!");
s1 = "§6A new version was found!§r";
}
T2Csend.console("§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion);
T2Csend.console("§6You can download it here: §ehttps://www.spigotmc.org/resources/" + spigot);
T2Csend.console("§6You can find more information on Discord: §e" + discord);
T2Csend.console("§4=========== " + prefix + " §4===========");
String text = "<br>" + h + "<br>" + s1 + "<br>" + s2 + "<br>" + s3 + "<br>" + s4 + "<br>" + h;
T2Csend.console(text);
}
private static Boolean load = false;
public static void onUpdateCheck(Plugin plugin, String prefix, int spigotID, String discord) {
new BukkitRunnable() {
@Override
@@ -100,21 +100,25 @@ public class T2CupdateAPI {
T2CupdateObject update = new T2CupdateObject(
plugin.getName(),
plugin.getDescription().getVersion(),
update_version
update_version,
false
);
pluginVersions.put(plugin.getName(), update);
if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) {
if (!load) {
if (!update.load) {
new BukkitRunnable() {
@Override
public void run() {
load = true;
update.load = true;
sendUpdateMsg(prefix, spigotID, discord, plugin);
}
}.runTaskLaterAsynchronously(plugin, 600L);
} else sendUpdateMsg(prefix, spigotID, discord, plugin);
} else {
T2Csend.console(prefix + " §2No update found.");
if (!update.load){
T2Csend.console(prefix + " §2No update found.");
update.load = true;
}
}
}, prefix, plugin.getDescription().getVersion());
}

View File

@@ -53,10 +53,16 @@ public class T2CupdateChecker {
}
inputStream.close();
} catch (IOException var10) {
Boolean load = false;
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())){
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
}
T2CupdateObject update = new T2CupdateObject(
plugin.getName(),
pluginVersion,
null
null,
load
);
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());

View File

@@ -1,16 +1,20 @@
package net.t2code.t2codelib.SPIGOT.api.update;
public class T2CupdateObject {
public String pluginName;
public String pluginVersion;
public String publicVersion;
public Boolean load;
public T2CupdateObject(String pluginName,
String pluginVersion,
String publicVersion ) {
String publicVersion ,
Boolean load) {
this.pluginName = pluginName;
this.pluginVersion = pluginVersion;
this.publicVersion = publicVersion;
this.load=load;
}
}