From 97d4187af35a13185aab70408018d510c4c4ad39 Mon Sep 17 00:00:00 2001 From: OllieJW <71931263+OllieJW@users.noreply.github.com> Date: Mon, 19 Jul 2021 22:08:36 +0100 Subject: [PATCH] Delete UpdateChecker.java --- .../oremarket/Utils/UpdateChecker.java | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/main/java/com/olliejw/oremarket/Utils/UpdateChecker.java diff --git a/src/main/java/com/olliejw/oremarket/Utils/UpdateChecker.java b/src/main/java/com/olliejw/oremarket/Utils/UpdateChecker.java deleted file mode 100644 index 985e44f..0000000 --- a/src/main/java/com/olliejw/oremarket/Utils/UpdateChecker.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.olliejw.oremarket.Utils; - -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.util.Consumer; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Scanner; - -public class UpdateChecker { - - private final JavaPlugin plugin; - private final int resourceId; - - public UpdateChecker(JavaPlugin plugin, int resourceId) { - this.plugin = plugin; - this.resourceId = resourceId; - } - - public void getVersion(final Consumer consumer) { - Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> { - try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream(); Scanner scanner = new Scanner(inputStream)) { - if (scanner.hasNext()) { - consumer.accept(scanner.next()); - } - } catch (IOException exception) { - this.plugin.getLogger().info("Cannot look for updates: " + exception.getMessage()); - } - }); - } -}