public final class UpdateChecker extends Object
Before any members of this class are accessed, of(Plugin, int) must
be invoked by the plugin, preferably in its JavaPlugin.onEnable() method,
though that is not a requirement.
This class performs asynchronous queries to Spigot's API. If the results of
requestUpdateCheck() are inconsistent with what is published on
SpigotMC, it may be due to the REST API cache. Results will be updated in due time.
| Modifier and Type | Class and Description |
|---|---|
static class |
UpdateChecker.UpdateReason
A constant reason for the result of
UpdateChecker.UpdateResult. |
class |
UpdateChecker.UpdateResult
Represents a result for an update query performed by
requestUpdateCheck(). |
static interface |
UpdateChecker.VersionScheme
A functional interface to compare two version Strings with similar version schemes.
|
| Modifier and Type | Field and Description |
|---|---|
static UpdateChecker.VersionScheme |
VERSION_SCHEME_DECIMAL
The default version scheme for this update checker.
|
| Constructor and Description |
|---|
UpdateChecker() |
| Modifier and Type | Method and Description |
|---|---|
static @NotNull UpdateChecker |
of(@NotNull org.bukkit.plugin.Plugin plugin,
int pluginID)
Creates a new instance of this update checker with the specified values.
|
static @NotNull UpdateChecker |
of(@NotNull org.bukkit.plugin.Plugin plugin,
int pluginID,
@NotNull UpdateChecker.VersionScheme versionScheme)
Creates a new instance of this update checker with the specified values.
|
@NotNull CompletableFuture<UpdateChecker.UpdateResult> |
requestUpdateCheck()
Request an update check to Spigot.
|
public static final UpdateChecker.VersionScheme VERSION_SCHEME_DECIMAL
@NotNull public @NotNull CompletableFuture<UpdateChecker.UpdateResult> requestUpdateCheck()
@NotNull public static @NotNull UpdateChecker of(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, int pluginID, @NotNull @NotNull UpdateChecker.VersionScheme versionScheme)
plugin - the plugin for which to check updates. Cannot be nullpluginID - the ID of the plugin as identified in the SpigotMC resource link.
For example, "https://www.spigotmc.org/resources/12038/" would
expect "12038" as a value. The value must be greater than 0versionScheme - a custom version scheme parser. Cannot be null@NotNull public static @NotNull UpdateChecker of(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, int pluginID)
plugin - the plugin for which to check updates. Cannot be nullpluginID - the ID of the plugin as identified in the SpigotMC resource link.
For example, "https://www.spigotmc.org/resources/veinminer.12038/" would
expect "12038" as a value. The value must be greater than 0Copyright © 2023. All rights reserved.