Skip to content

Update Checker

Florian Fülling edited this page Jun 3, 2021 · 1 revision

The Update checker is a plug and play update checker for your plugin.

Usage

To check if a update is available call the static method performAndNotifyUpdateCheck()`

UpdateChecker.performAndNotifyUpdateCheck(pluginInstance, 80805);

The numbers should be your plugin id. You can find it at the end of your resources link on spigot.
https://www.spigotmc.org/resources/big-doors-opener.80805/
In this case its 80805.

And that's all. If a update is available the user will get a message in the console at startup or whenever you call this method. Sitenote: You should set the resource page at your website at the plugin.yml. This link will be printed in the console to update.

Further functions:

Of course that's not all. You can also start a listener to notify operators or players with a specific permission about this update.
To do this pass a permission to the method.

UpdateChecker.performAndNotifyUpdateCheck(pluginInstance, 80805, "admin.permission");

If you don't want to define a permission you can just set this to true. We will then use the plugin name as a permission. This will most likely only match if the user has a '*' permission.

UpdateChecker.performAndNotifyUpdateCheck(pluginInstance, 80805, true);
Clone this wiki locally