From b3adbe61e86fb1a6f34d9395d610efeced5d6a45 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Sun, 23 Apr 2023 14:33:42 +0200 Subject: [PATCH] Improved Update Information --- .../t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java | 5 +++-- .../net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java | 2 +- .../t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java | 3 ++- src/main/java/net/t2code/t2codelib/T2CupdateWebData.java | 5 ++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java b/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java index ab35edb..c471712 100644 --- a/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java +++ b/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateCheckerGit.java @@ -27,7 +27,7 @@ public class T2CBupdateCheckerGit { public void getVersion(Consumer consumer, String pluginVersion, Integer spigotID, String gitKey) { String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1"; - if (!T2CBlibConfig.getSeePreReleaseUpdates()){ + if (!T2CBlibConfig.getSeePreReleaseUpdates()) { RepoURL = RepoURL + "&pre-release=false"; } String finalRepoURL = RepoURL; @@ -62,6 +62,7 @@ public class T2CBupdateCheckerGit { String formattedDate = outputFormat.format(parsedDate); JSONArray downloadArray = obj.getJSONArray("assets"); + String gitURL = updateurl; String downloadURL; if (downloadArray.isEmpty()) { downloadURL = "https://www.spigotmc.org/resources/" + spigotID; @@ -74,7 +75,7 @@ public class T2CBupdateCheckerGit { updateurl = "https://www.spigotmc.org/resources/" + spigotID; } - T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, prerelease); + T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease); consumer.accept(webData); } catch (Exception var10) { Boolean load = false; diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java index f40ec9c..ac04b09 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java @@ -156,7 +156,7 @@ public class T2CupdateAPI { String updateButton; if (player) { updateButton = "
" + updateUpdate + "'>Download | Update Description"; + + "'>Download | Update Description"; } else updateButton = "
Download: " + updateUpdate + ""; String text; diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java index e9bc72e..9f31c81 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateCheckerGit.java @@ -102,6 +102,7 @@ public class T2CupdateCheckerGit { Date parsedDate = inputFormat.parse(date); String formattedDate = outputFormat.format(parsedDate); + String gitURL = updateurl; JSONArray downloadArray = obj.getJSONArray("assets"); String downloadURL; if (downloadArray.isEmpty()) { @@ -115,7 +116,7 @@ public class T2CupdateCheckerGit { updateurl = "https://www.spigotmc.org/resources/" + spigotID; } - T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, prerelease); + T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease); consumer.accept(webData); } catch (Exception var10) { Boolean load = false; diff --git a/src/main/java/net/t2code/t2codelib/T2CupdateWebData.java b/src/main/java/net/t2code/t2codelib/T2CupdateWebData.java index f523d81..be9f8f9 100644 --- a/src/main/java/net/t2code/t2codelib/T2CupdateWebData.java +++ b/src/main/java/net/t2code/t2codelib/T2CupdateWebData.java @@ -16,15 +16,18 @@ public class T2CupdateWebData { @Getter private String downloadURL; @Getter + private String gitURL; + @Getter private boolean preRelease; - public T2CupdateWebData(String updateTitle, String version, String updateDescription, String updateUrl, String publishedAt, String downloadURL, boolean preRelease) { + public T2CupdateWebData(String updateTitle, String version, String updateDescription, String updateUrl, String publishedAt, String downloadURL, String gitURL, boolean preRelease) { this.updateTitle = updateTitle; this.version = version; this.updateDescription = updateDescription; this.updateUrl = updateUrl; this.publishedAt = publishedAt; this.downloadURL = downloadURL; + this.gitURL = gitURL; this.preRelease = preRelease; } }