PDEK/Spigot Versioning
Spigot Versioning Kit
This kit is extremely useful if you want to warn the users of your plugin that has a new version, basicaly for use this you need your plugin posted in the Spigotmc.org
This kit get the version of your plugin/resource in the spigot website and compare with the version of your plugin in plugin.yml, if the two version is equals it advice that no has new version, if is different it advice that has a new version ready to be downloaded
To use this versioning kit you need use the code:
VersionManager.getVersion(this, 88025, Version ->{
if(Version.equalsIgnoreCase(this.getDescription().getVersion())) {
this.getServer().getConsoleSender().sendMessage("No update, current version: " + Version);
}else {
this.getServer().getConsoleSender().sendMessage("Update, new version: " + Version);
}
});
Where: "this", is the plugin class, this code needs to be inserted in onEnable function, "88025" is the ID of your resource in spigotmc.org and "Version" is the version of your resource in spigotmc.org
In the end your main plugin class has like this
How to get the Spigot Resource ID
After you create the resource of your plugin in spigotmc.org, you get the resource ID in the url
Comments