version
fun version(resourceId: Int, onLatest: () -> Unit = {}, onOutdated: (latestVersion: String, downloadLink: String) -> Unit)
Checks if there is a new version of the plugin available on SpigotMC.
Parameters
on Latest
(Optional) Action to execute if the plugin is up to date. Default is an empty function.
on Outdated
Action to execute if a new version is available. It provides:
latestVersion
: The latest version available on SpigotMC.downloadLink
: The direct link to the plugin's resource page on SpigotMC.
Example usage:
val spigotUtil = SpigotUtil(plugin, 12345) // SpigotMC resource ID
spigotUtil.version(
onLatest = {
plugin.logger.info("You are running the latest version.")
},
onOutdated = { latestVersion, downloadLink ->
plugin.logger.info("A new version ($latestVersion) is available! Download it here: $downloadLink")
}
)
Content copied to clipboard