Skip to content

Commit

Permalink
Another correction
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Sep 28, 2024
1 parent 4276f95 commit ef9815d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions bukkit/src/main/java/io/wdsj/asw/bukkit/update/Updater.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ protected boolean isDevUpdateAvailable() {
connection.setReadTimeout(5000);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStreamReader reader = new InputStreamReader(connection.getInputStream());
JsonObject jsonObject = new JsonParser().parse(reader).getAsJsonObject();
String latestHash = jsonObject.get("sha").getAsString();
latestVersion = latestHash.substring(0, 7);
currentVersion = PluginVersionTemplate.COMMIT_HASH_SHORT;
isUpdateAvailable = !PluginVersionTemplate.COMMIT_HASH.equals(latestHash);
return isUpdateAvailable;
try (InputStreamReader reader = new InputStreamReader(connection.getInputStream())) {
JsonObject jsonObject = new JsonParser().parse(reader).getAsJsonObject();
String latestHash = jsonObject.get("sha").getAsString();
latestVersion = latestHash.substring(0, 7);
currentVersion = PluginVersionTemplate.COMMIT_HASH_SHORT;
isUpdateAvailable = !PluginVersionTemplate.COMMIT_HASH.equals(latestHash);
reader.close();
return isUpdateAvailable;
}
}
} catch (Exception ignored) {
}
Expand Down

0 comments on commit ef9815d

Please sign in to comment.