Skip to content

Commit

Permalink
Fix paper API
Browse files Browse the repository at this point in the history
  • Loading branch information
Jo0001 committed Jan 2, 2025
1 parent abd469c commit 17cd771
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.jo0001</groupId>
<artifactId>ViaTesting</artifactId>
<version>1.6</version>
<version>1.7</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/de/jo0001/viaTesting/util/DownloadUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
public class DownloadUtil {
public static URL getDownloadURL(String type, String version) throws IOException {
int build = getLatestBuild(type, version);
return new URL("https://papermc.io/api/v2/projects/" + type + "/versions/" + version + "/builds/" + build + "/downloads/" + type + "-" + version + "-" + build + ".jar");
return new URL("https://api.papermc.io/v2/projects/" + type + "/versions/" + version + "/builds/" + build + "/downloads/" + type + "-" + version + "-" + build + ".jar");
}

private static int getLatestBuild(String type, String version) throws IOException {
String url = "https://papermc.io/api/v2/projects/" + type + "/versions/" + version;
String url = "https://api.papermc.io/v2/projects/" + type + "/versions/" + version;
JsonArray builds = fetchData(url).getAsJsonArray("builds");
return builds.get(builds.size() - 1).getAsInt();
}

public static String getLatestProxyMCVersion(String proxy) throws IOException {
JsonArray versions = fetchData("https://papermc.io/api/v2/projects/" + proxy).getAsJsonArray("versions");
JsonArray versions = fetchData("https://api.papermc.io/v2/projects/" + proxy).getAsJsonArray("versions");
return versions.get(versions.size() - 1).getAsString();
}

Expand All @@ -45,7 +45,7 @@ public static String getLatestViaFromHangar(String project, String platform) thr
}

public static JsonArray getVersions() throws IOException {
return fetchData("https://papermc.io/api/v2/projects/paper").getAsJsonArray("versions");
return fetchData("https://api.papermc.io/v2/projects/paper").getAsJsonArray("versions");
}

public static JsonObject getLatestViaTesting() throws IOException {
Expand Down

0 comments on commit 17cd771

Please sign in to comment.