Spigot Auto Updater is easy, safe auto-updater for your plugins.
Uses Spiget API to get information of your plugin.
int ID = 29742;
Updater updater = new Updater(this, ID, this.getFile(), Updater.UpdateType.CHECK_DOWNLOAD, false);
this
- is the plugin instance.
ID
- is the project id which can be found on project site.
this.getFile()
- The plugin's file name.
Updater.UpdateType.CHECK_DOWNLOAD
- sets the download type, this type will check if new update exists and immediately downloads if it does.
false
- if set to false Updater won't log the process to console.
There are 3 different update types:
Updater.UpdateType.CHECK_VERSION
- Only check the version of the latest file. (Which can be obtained with Updater#getVersion)Updater.UpdateType.DOWNLOAD
- Downloads the latest file without checking version.Updater.UpdateType.CHECK_DOWNLOAD
- Checks if update exists if it does downloads it.
There are 5 different result types:
Updater.Result.UPDATE_FOUND
- When update is found.Updater.Result.NO_UPDATE
- When no update is found.Updater.Result.SUCCESS
- When file is successfuly downloaded.Updater.Result.FAILED
- For some reason update was not successfuly downloaded.Updater.Result.BAD_ID
- If bad ID was passed.
You can get Result with Updater#getResult.
You can find your project id on spigot resource site.