Skip to content

Commit

Permalink
Merge branch 'Gecolay:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq authored May 8, 2024
2 parents 2d305f3 + d688d63 commit 835e3d2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/src/main/java/dev/geco/gsit/manager/UManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ public void checkForUpdates() {
public void loginCheckForUpdates(Player Player) { if(GPM.getCManager().CHECK_FOR_UPDATE && !latestVersion && GPM.getPManager().hasPermission(Player, "Update")) GPM.getMManager().sendMessage(Player, "Plugin.plugin-update", "%Name%", GPM.NAME, "%NewVersion%", spigotVersion, "%Version%", GPM.getDescription().getVersion(), "%Path%", GPM.getDescription().getWebsite()); }

private void getSpigotVersion(final Consumer<String> VersionConsumer) {
if(Integer.parseInt(GPM.RESOURCE) == 0) {
VersionConsumer.accept(null);
return;
}
GPM.getTManager().run(() -> {
try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + GPM.RESOURCE).openStream();
Scanner scanner = new Scanner(inputStream)) {
if(scanner.hasNext() && VersionConsumer != null) VersionConsumer.accept(scanner.next());
} catch (IOException e) { e.printStackTrace(); }
} catch (IOException e) {
if(e.getMessage().contains("50")) return;
e.printStackTrace();
}
}, false);
}

Expand Down

0 comments on commit 835e3d2

Please sign in to comment.