diff options
| author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-10-18 21:01:11 +1100 |
|---|---|---|
| committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-10-18 21:01:11 +1100 |
| commit | a0402708801b525145d01d0f4da17f0ba9d93455 (patch) | |
| tree | ce0b58df707388449558073df3aa9492efaf8978 /src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java | |
| parent | 275fe45caa8eb1048914d864aafae21f3f3a1157 (diff) | |
| download | notenoughupdates-a0402708801b525145d01d0f4da17f0ba9d93455.tar.gz notenoughupdates-a0402708801b525145d01d0f4da17f0ba9d93455.tar.bz2 notenoughupdates-a0402708801b525145d01d0f4da17f0ba9d93455.zip | |
1.4
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java index d6f89409..2e6b29da 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java @@ -24,7 +24,7 @@ public class HypixelApi { private ExecutorService es = Executors.newFixedThreadPool(3); private int myApiErrors = 0; - private String[] myApiURLs = {"https://moulberry.codes/", "http://51.89.22.3/", "http://moulberry.codes/", "https://51.89.22.3/"}; + private String[] myApiURLs = {"https://moulberry.codes/", "http://51.75.78.252/", "http://moulberry.codes/" }; public void getHypixelApiAsync(String apiKey, String method, HashMap<String, String> args, Consumer<JsonObject> consumer) { getHypixelApiAsync(apiKey, method, args, consumer, () -> {}); @@ -42,7 +42,7 @@ public class HypixelApi { es.submit(() -> { try { consumer.accept(getApiSync(urlS)); - } catch(IOException e) { + } catch(Exception e) { error.run(); } }); @@ -52,7 +52,7 @@ public class HypixelApi { es.submit(() -> { try { consumer.accept(getApiSync(getMyApiURL()+urlS)); - } catch(IOException e) { + } catch(Exception e) { myApiErrors++; error.run(); } @@ -63,7 +63,7 @@ public class HypixelApi { es.submit(() -> { try { consumer.accept(getApiGZIPSync(getMyApiURL()+urlS)); - } catch(IOException e) { + } catch(Exception e) { myApiErrors++; error.run(); } @@ -74,7 +74,7 @@ public class HypixelApi { es.submit(() -> { try { consumer.accept(getApiGZIPSync(urlS)); - } catch(IOException e) { + } catch(Exception e) { error.run(); } }); @@ -83,7 +83,7 @@ public class HypixelApi { public JsonObject getApiSync(String urlS) throws IOException { URL url = new URL(urlS); URLConnection connection = url.openConnection(); - connection.setConnectTimeout(3000); + connection.setConnectTimeout(10000); connection.setReadTimeout(10000); String response = IOUtils.toString(connection.getInputStream(), StandardCharsets.UTF_8); @@ -95,7 +95,7 @@ public class HypixelApi { public JsonObject getApiGZIPSync(String urlS) throws IOException { URL url = new URL(urlS); URLConnection connection = url.openConnection(); - connection.setConnectTimeout(3000); + connection.setConnectTimeout(10000); connection.setReadTimeout(10000); String response = IOUtils.toString(new GZIPInputStream(connection.getInputStream()), StandardCharsets.UTF_8); |
