Archiviert
13
0
Dieser Commit ist enthalten in:
Dan Mulloy 2018-09-18 17:04:10 -04:00
Commit 6ff6976e85

Datei anzeigen

@ -97,9 +97,7 @@ public final class SpigotUpdater extends Updater {
private static final byte[] API_KEY = ("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=" + ID).getBytes(Charsets.UTF_8); private static final byte[] API_KEY = ("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=" + ID).getBytes(Charsets.UTF_8);
public String getSpigotVersion() throws IOException { public String getSpigotVersion() throws IOException {
Closer closer = Closer.create(); try (Closer closer = Closer.create()) {
try {
HttpURLConnection con = (HttpURLConnection) new URL(API_URL).openConnection(); HttpURLConnection con = (HttpURLConnection) new URL(API_URL).openConnection();
con.setDoOutput(true); con.setDoOutput(true);
con.setRequestMethod(ACTION); con.setRequestMethod(ACTION);
@ -108,8 +106,6 @@ public final class SpigotUpdater extends Updater {
InputStreamReader isr = closer.register(new InputStreamReader(con.getInputStream())); InputStreamReader isr = closer.register(new InputStreamReader(con.getInputStream()));
BufferedReader br = closer.register(new BufferedReader(isr)); BufferedReader br = closer.register(new BufferedReader(isr));
return br.readLine(); return br.readLine();
} finally {
closer.close();
} }
} }