mirror of
https://github.com/amalthea-mc/Ore-Market.git
synced 2024-11-09 20:21:07 +00:00
Delete UpdateChecker.java
This commit is contained in:
parent
5c109a2be7
commit
97d4187af3
@ -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<String> 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());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user