diff options
author | Cow <cow@volloeko.de> | 2023-07-23 09:31:45 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2023-07-23 09:31:45 +0200 |
commit | c4a4eebe2d322b59638720760e1ff45f64b2fa5e (patch) | |
tree | be6f5d8c69aa9ede5c4ef9a4580794b82f9f5be0 /src/main/java/de/cowtipper/cowlection/util | |
parent | 78fb1b936ef2efe8de4e0c48397022d595062ab1 (diff) | |
download | Cowlection-c4a4eebe2d322b59638720760e1ff45f64b2fa5e.tar.gz Cowlection-c4a4eebe2d322b59638720760e1ff45f64b2fa5e.tar.bz2 Cowlection-c4a4eebe2d322b59638720760e1ff45f64b2fa5e.zip |
Added link to 'note on API keys' to API key related error messages
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/util')
-rw-r--r-- | src/main/java/de/cowtipper/cowlection/util/ApiUtils.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java b/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java index b8fa4a5..89c979b 100644 --- a/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java +++ b/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java @@ -164,7 +164,7 @@ public class ApiUtils { private static BufferedReader makeApiCall(String url, boolean sendApiKey, String key) throws IOException { if (sendApiKey && !CredentialStorage.isMooValid) { - throw new ApiHttpErrorException("Your current Hypixel API key is invalid. Use /moo apikey to manually set your existing API key.", url); + throw new ApiHttpErrorException("Your current Hypixel API key is invalid. Use §4/moo apikey §cto manually set your API key.", url, true); } try { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); @@ -182,10 +182,10 @@ public class ApiUtils { if (connection.getResponseCode() == HttpStatus.SC_NO_CONTENT) { // http status 204 return null; } else if (connection.getResponseCode() == HttpStatus.SC_BAD_GATEWAY && url.startsWith("https://api.hypixel.net/")) { // http status 502 (cloudflare) - throw new ApiHttpErrorException("Couldn't contact Hypixel API (502 Bad Gateway). API might be down, check https://status.hypixel.net for info.", "https://status.hypixel.net"); + throw new ApiHttpErrorException("Couldn't contact Hypixel API (502 Bad Gateway). API might be down, check https://status.hypixel.net for info.", "https://status.hypixel.net", sendApiKey); } else if (connection.getResponseCode() == HttpStatus.SC_FORBIDDEN && sendApiKey && url.startsWith("https://api.hypixel.net/")) { // http status 403 Forbidden Cowlection.getInstance().getMoo().setMooValidity(false); - throw new ApiHttpErrorException("Your current Hypixel API key seems to be invalid. Use /moo apikey to manually set your existing API key.", url); + throw new ApiHttpErrorException("Your current Hypixel API key seems to be invalid. Use §4/moo apikey §cto manually set your API key.", url, true); } else if (connection.getResponseCode() == HttpStatus.SC_SERVICE_UNAVAILABLE) { // http status 503 Service Unavailable throw new ApiHttpErrorException("Couldn't contact the API (503 Service unavailable). API might be down, or you might be blocked by Cloudflare, check if you can reach: " + url, url, sendApiKey); } else if (connection.getResponseCode() == HttpStatus.SC_BAD_GATEWAY && url.startsWith("https://moulberry.codes/")) { // http status 502 (cloudflare) |