diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-04-20 09:00:05 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-04-20 09:00:05 -0400 |
commit | e1fb5cf460f95fc7fadab9b167531b8380d0caf1 (patch) | |
tree | 4f3290822580ecaad19c0075fc08c45fde32de8e /src/main/java/me/Danker/handlers/APIHandler.java | |
parent | 4e4bc07819f595107ad23d2bb003f518d1344ec5 (diff) | |
download | SkyblockMod-e1fb5cf460f95fc7fadab9b167531b8380d0caf1.tar.gz SkyblockMod-e1fb5cf460f95fc7fadab9b167531b8380d0caf1.tar.bz2 SkyblockMod-e1fb5cf460f95fc7fadab9b167531b8380d0caf1.zip |
Add /player
Diffstat (limited to 'src/main/java/me/Danker/handlers/APIHandler.java')
-rw-r--r-- | src/main/java/me/Danker/handlers/APIHandler.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java index c9460fe..66001a3 100644 --- a/src/main/java/me/Danker/handlers/APIHandler.java +++ b/src/main/java/me/Danker/handlers/APIHandler.java @@ -25,6 +25,7 @@ public class APIHandler { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); + conn.setRequestProperty("User-Agent", "Dsm/1.0"); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); @@ -40,7 +41,7 @@ public class APIHandler { return gson.fromJson(response.toString(), JsonObject.class); } else { - if (urlString.startsWith("https://api.hypixel.net/")) { + if (urlString.startsWith("https://api.hypixel.net/") || urlString.startsWith("https://hypixel-api.senither.com")) { InputStream errorStream = conn.getErrorStream(); try (Scanner scanner = new Scanner(errorStream)) { scanner.useDelimiter("\\Z"); |