Update checker now checks a new url, not sure why I thought https wouldn't be touched.

This commit is contained in:
libraryaddict 2020-01-18 14:52:53 +13:00
parent caf5587ccb
commit 765b07a46a
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4

View File

@ -72,21 +72,9 @@ public class UpdateChecker {
private String fetchSpigotVersion() { private String fetchSpigotVersion() {
try { try {
// We're connecting to spigot's API // We're connecting to spigot's API
URL url = new URL("https://www.spigotmc.org/api/general.php"); URL url = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + resourceID);
// Creating a connection // Creating a connection
HttpURLConnection con = (HttpURLConnection) url.openConnection(); HttpURLConnection con = (HttpURLConnection) url.openConnection();
// We're writing a body that contains the API access key (Not required and obsolete, but!)
con.setDoOutput(true);
// Can't think of a clean way to represent this without looking bad
String body = "key" + "=" + "98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4" + "&" +
"resource=" + this.resourceID;
// Get the output stream, what the site receives
try (OutputStream stream = con.getOutputStream()) {
// Write our body containing version and access key
stream.write(body.getBytes(StandardCharsets.UTF_8));
}
// Get the input stream, what we receive // Get the input stream, what we receive
try (InputStream input = con.getInputStream()) { try (InputStream input = con.getInputStream()) {