Class UpdateChecker

java.lang.Object
me.croabeast.common.updater.UpdateChecker

public final class UpdateChecker extends Object
Checks for plugin updates on supported platforms by querying their respective APIs, parsing the returned JSON, and comparing the latest remote version against the currently installed version.

Supports custom version-comparison schemes and platforms: SpigotMC, Modrinth, and GitHub. All network operations are performed asynchronously to avoid blocking the main server thread.

Author:
Parker Hawke - Choco (forked by CroaBeast)
See Also:
  • Constructor Details

    • UpdateChecker

      public UpdateChecker()
  • Method Details

    • requestCheck

      @NotNull public @NotNull CompletableFuture<@NotNull UpdateResult> requestCheck(String id, Platform platform)
      Performs the HTTP request and JSON parsing asynchronously, then compares the remote version against the installed one.
      Parameters:
      id - The project identifier, plugged into the
      invalid reference
      Platform#getUrlTemplate()
      platform - The platform from which to fetch version information.
      Returns:
      a CompletableFuture completing with the UpdateResult
      Throws:
      IllegalArgumentException - if identifier is blank
      NullPointerException - if the platform is null
    • requestCheck

      @NotNull public @NotNull CompletableFuture<@NotNull UpdateResult> requestCheck(int id, Platform platform)
      Performs the HTTP request and JSON parsing asynchronously, then compares the remote version against the installed one.
      Parameters:
      id - The project identifier, plugged into the
      invalid reference
      Platform#getUrlTemplate()
      platform - The platform from which to fetch version information.
      Returns:
      a CompletableFuture completing with the UpdateResult
      Throws:
      NullPointerException - if the platform is null
    • of

      @NotNull public static @NotNull UpdateChecker of(org.bukkit.plugin.Plugin plugin, VersionScheme scheme)
      Factory method to create an UpdateChecker with all parameters.
      Parameters:
      plugin - the plugin instance (non-null)
      scheme - the version comparison scheme (non-null)
      Returns:
      a configured UpdateChecker
      Throws:
      NullPointerException - if any required argument is null
    • of

      @NotNull public static @NotNull UpdateChecker of(org.bukkit.plugin.Plugin plugin)
      Convenience factory using the default decimal VersionScheme.DECIMAL_SCHEME.
      Parameters:
      plugin - the plugin instance
      Returns:
      a configured UpdateChecker
      Throws:
      NullPointerException - if the plugin is null