This commit is contained in:
Telesphoreo 2023-03-08 19:29:30 -06:00
parent ea512487ac
commit 37649f1fdc
No known key found for this signature in database
GPG Key ID: B5CDDEBA526C0130

View File

@ -5,6 +5,16 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
import dev.plex.PlexBase; import dev.plex.PlexBase;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nonnull;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -15,19 +25,9 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import javax.annotation.Nonnull;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;
public class UpdateChecker implements PlexBase public class UpdateChecker implements PlexBase
{ {
/* /*
@ -48,7 +48,7 @@ public class UpdateChecker implements PlexBase
{ {
try try
{ {
HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/" + repo + "/compare/" + branch + "..." + hash).openConnection(); HttpURLConnection connection = (HttpURLConnection)new URL("https://api.github.com/repos/" + repo + "/compare/" + branch + "..." + hash).openConnection();
connection.connect(); connection.connect();
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND)
{ {
@ -197,5 +197,9 @@ public class UpdateChecker implements PlexBase
{ {
e.printStackTrace(); e.printStackTrace();
} }
catch (JSONException e)
{
sender.sendMessage(PlexUtils.mmDeserialize("<red>The file could not be downloaded because Jenkins returned an invalid response. (Is it on Jenkins?)"));
}
} }
} }