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

@@ -2,11 +2,10 @@ package net.t2code.t2codelib.SPIGOT.api.update;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.SPIGOT.system.UpdateType;
import net.t2code.t2codelib.UpdateType;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import net.t2code.t2codelib.T2CupdateObject;
import net.t2code.t2codelib.T2CupdateWebData;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
@@ -94,16 +93,17 @@ public class T2CupdateAPI {
value = UpdateType.SNAPSHOT.text;
}
} else value = UpdateType.STABLE.text;
String h = "§4=========== " + prefix + " §4===========";
String s1 = "§6A new [value] version was found!§r".replace("[value]", value);
String s2 = "§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + webData.getVersion();
String s3 = "§6You can download it here: §e" + webData.getUpdateUrl();
String s4 = "§6You can find more information on Discord: §e" + discord;
String text = "<br>" + h + "<br>" + s1 + "<br>" + s2 + "<br>" + s3 + "<br>" + s4 + "<br>" + h;
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
String s1 = "<br><dark_red>║</dark_red> <gold>A new [value] version was found!</gold>".replace("[value]", value);
String s2 = "<br><dark_red>║</dark_red> <gold>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</gold> <green>" + webData.getVersion() + "</green>";
String s3 = "<br><dark_red>║</dark_red> <gold>You can download it here:</gold> <yellow>" + webData.getUpdateUrl() + "</yellow>";
String s4 = "<br><dark_red>║</dark_red> <gold>You can find more information on Discord:</gold> <yellow>" + discord + "</yellow>";
String f = "<br><dark_red>╚══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
String text = h + s1 + s2 + s3 + s4 + f;
T2Csend.console(text);
}
public static String updateInfo(CommandSender sender, String[] args, Boolean player) {
public static String updateInfo(String[] args, Boolean player) {
T2CupdateObject object;
try {
object = T2CupdateAPI.pluginVersions.get(args[1]);
@@ -140,12 +140,11 @@ public class T2CupdateAPI {
String updateInfoString = "<br><dark_red>║</dark_red> <color:#308aff>[value]:</color>";
String updateTitleString = "<br><dark_red>║</dark_red> <yellow>Title:</yellow> <color:#5eff89>" + updateTitle + "</color>";
String updateVersionString = "<br><dark_red>║</dark_red> <yellow>Version:</yellow> <color:#5eff89>" + updateVersion + "</color>";
String updateAtString = "<br><dark_red>║</dark_red> <yellow>Update at:</yellow> <color:#5eff89>" + updateAt + "</color>";
String updateTypeString = "<br><dark_red>║</dark_red> <yellow>Update type:</yellow> <color:#5eff89>" + updateType + "</color>";
String updateAtString = "<br><dark_red>║</dark_red> <yellow>Published on:</yellow> <color:#5eff89>" + updateAt + "</color>";
String updateTypeString = "<br><dark_red>║</dark_red> <yellow>Version type:</yellow> <color:#5eff89>" + updateType + "</color>";
String updateButton;
if (player) {
// updateButton = "<br><dark_red>║</dark_red> <color:#5eff89><hover:show_text:'<gold>" + updateUpdate + "</gold>'><click:open_url:'" + updateUpdate +"'>Download</click></hover></color>";
updateButton = "<br><dark_red>║</dark_red> <color:#5eff89><hover:show_text:'<gold>" + updateUpdate + "</gold>'><click:open_url:'" + updateUpdate + "'>Download</click></hover></color> <dark_gray>|</dark_gray> <blue><hover:show_text:'" + updateDescription + "'>Update Description</hover></blue>";
} else updateButton = "<br><dark_red>║</dark_red> <color:#5eff89>Download:</color> <gold>" + updateUpdate + "</gold>";
@@ -170,7 +169,6 @@ public class T2CupdateAPI {
return text;
}
public static void onUpdateCheck(Plugin plugin, String prefix, int spigotID, String discord) {
new BukkitRunnable() {
@Override
@@ -184,7 +182,7 @@ public class T2CupdateAPI {
false, !plugin.getDescription().getVersion().equals(update_version)
);
pluginVersions.put(plugin.getName(), update);
if (!pluginVersions.get(plugin.getName()).updateAvailable) {
if (pluginVersions.get(plugin.getName()).updateAvailable) {
if (!update.load) {
new BukkitRunnable() {
@Override
@@ -222,7 +220,7 @@ public class T2CupdateAPI {
!plugin.getDescription().getVersion().equals(webData.getVersion())
);
pluginVersions.put(plugin.getName(), update);
if (!pluginVersions.get(plugin.getName()).updateAvailable) {
if (pluginVersions.get(plugin.getName()).updateAvailable) {
if (!update.load) {
new BukkitRunnable() {
@Override