content: package me.sat7.dynamicshop;
  
  import org.bukkit.Bukkit;
  import org.bukkit.plugin.java.JavaPlugin;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.net.URL;
  import java.util.Scanner;
  import java.util.function.Consumer;
  
  public class UpdateChecker
  {
      public static final int PROJECT_ID = 65603;//100058;
      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)
              {
                  plugin.getLogger().info("Unable to check for updates: " + exception.getMessage());
              }
          });
      }
  
      public static String getResourceUrl()
      {
          return "https://spigotmc.org/resources/" + PROJECT_ID;
      }
  }