Class UpdateChecker
java.lang.Object
com.zetaplugins.zetacore.services.updatechecker.UpdateChecker
- Direct Known Subclasses:
GitHubUpdateChecker,HangarUpdateChecker,ModrinthUpdateChecker
Abstract class for checking updates for a JavaPlugin.
Subclasses should implement the checkForUpdates method to define
how updates are checked.
-
Constructor Summary
ConstructorsConstructorDescriptionUpdateChecker(JavaPlugin plugin) Constructs an UpdateChecker for the given plugin. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcheckForUpdates(boolean logMessage) Checks for updates for the plugin.abstract Stringprotected Loggerprotected StringgetNewVersionConsoleMessage(String latestVersion, String currentVersion, String newVersionUrl) Generates a console message indicating that a new version is available.protected JavaPluginbooleanprotected voidsetLatestVersion(String latestVersion) protected voidsetNewVersionAvailable(boolean available)
-
Constructor Details
-
UpdateChecker
Constructs an UpdateChecker for the given plugin.- Parameters:
plugin- The JavaPlugin to check updates for
-
-
Method Details
-
checkForUpdates
public abstract void checkForUpdates(boolean logMessage) Checks for updates for the plugin.- Parameters:
logMessage- If true, logs a message if a new version is available
-
getNewVersionConsoleMessage
protected String getNewVersionConsoleMessage(String latestVersion, String currentVersion, String newVersionUrl) Generates a console message indicating that a new version is available.- Parameters:
latestVersion- The latest version availablecurrentVersion- The current version of the pluginnewVersionUrl- The URL to download the new version- Returns:
- The formatted console message
-
setNewVersionAvailable
protected void setNewVersionAvailable(boolean available) -
isNewVersionAvailable
public boolean isNewVersionAvailable() -
setLatestVersion
-
getLatestVersion
-
getLatestVersionUrl
-
getPlugin
-
getLogger
-