Compare commits
2 Commits
8bbdd7a818
...
b3adbe61e8
Author | SHA1 | Date | |
---|---|---|---|
b3adbe61e8 | |||
167b81f0df |
@ -27,7 +27,7 @@ public class T2CBupdateCheckerGit {
|
||||
|
||||
public void getVersion(Consumer<T2CupdateWebData> 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;
|
||||
|
@ -17,13 +17,13 @@ public class T2CupdateAPI {
|
||||
public static HashMap<String, T2CupdateObject> pluginVersions = new HashMap<>();
|
||||
|
||||
public static void join(Plugin plugin, String prefix, String perm, Player player, Integer spigotID, String discord) {
|
||||
if (pluginVersions.get(plugin.getName()) == null){
|
||||
if (pluginVersions.get(plugin.getName()) == null) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
join(plugin,prefix,perm,player,spigotID,discord);
|
||||
join(plugin, prefix, perm, player, spigotID, discord);
|
||||
}
|
||||
},2*20L);
|
||||
}, 2 * 20L);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ public class T2CupdateAPI {
|
||||
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> <dark_gray>|</dark_gray> <color:#ff9499><hover:show_text:'" + updateDescription + "'>Update Description</hover></color>";
|
||||
+ "'>Download</click></hover></color> <dark_gray>|</dark_gray> <color:#ff9499><hover:show_text:'" + updateDescription + "'><click:open_url:'" + webData.getGitURL() + "'>Update Description</click></hover></color>";
|
||||
} else updateButton = "<br><dark_red>║</dark_red> <color:#5eff89>Download:</color> <gold>" + updateUpdate + "</gold>";
|
||||
|
||||
String text;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user