Package me.croabeast.common.updater
Class UpdateChecker
java.lang.Object
me.croabeast.common.updater.UpdateChecker
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull UpdateCheckerof(org.bukkit.plugin.Plugin plugin) Convenience factory using the default decimalVersionScheme.DECIMAL_SCHEME.static @NotNull UpdateCheckerof(org.bukkit.plugin.Plugin plugin, VersionScheme scheme) Factory method to create anUpdateCheckerwith all parameters.@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.@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.
-
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 theinvalid reference
Platform#getUrlTemplate()platform- The platform from which to fetch version information.- Returns:
- a
CompletableFuturecompleting with theUpdateResult - Throws:
IllegalArgumentException- if identifier is blankNullPointerException- 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 theinvalid reference
Platform#getUrlTemplate()platform- The platform from which to fetch version information.- Returns:
- a
CompletableFuturecompleting with theUpdateResult - 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 anUpdateCheckerwith 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
Convenience factory using the default decimalVersionScheme.DECIMAL_SCHEME.- Parameters:
plugin- the plugin instance- Returns:
- a configured
UpdateChecker - Throws:
NullPointerException- if the plugin is null
-