Hello, I would like to present to you, a plugin updating class that checks for the latest version of the plugin and allows users to update using the /update command. The class uses BukGet to check for the latest version of the plugin and uses a Bukkit staff approved [Mod Edit: This is not a Bukkit approved method of downloading] method of downloading the update. A main advantage of this is class that it is very easy to integrate this class to your plugin. The source code can be found here How to use this in your plugin: Firstly, add the class file to your plugin. Then add the following command to your onEnable() method Code:java PluginUpdater update = new PluginUpdater();update.onStart(this); Third, go to the PluginUpdater class and locate the slug variable. It will look something like this. Code:java public class PluginUpdater implements Runnable, Listener, CommandExecutor{private static String slug = ""; Add your plugin slug here. Your plugin slug can be found in the bukkit dev link of your plugin. For example, if this is your link (http://dev.bukkit.org/bukkit-plugins/serverstaffchat/), then your slug will be "serverstaffchat". Lastly, go to your plugin.yml file and add the following command: Code: update: description: Chat stream for mods. aliases: [ud] permission: pluginupdater.update usage: /update pluginupdater Permissions: pluginupdater.announce - Users with his permissions get a message when a new update is available, and other messages that are sent during the update process. pluginupdate.update - This permission gives access to the use of the /update command Command: /update <plugin> How does the class work: The class checks for the latest version of the plugin every hour, and if it finds a new version, sends a message to everyone with the announce permission. When /update is used, the class downloads the latest version of the plugin into the Updates directory inside the plugins directory. Once the download is over, the user needs to delete the old version of the plugin, move the new file into the plugins folder, and restart the server. Licensed under CC Attribution-ShareAlike 4.0 International This class file was inspired by, and based off V10lator's original AutoUpdate class.
It's worth noting that the guidelines on updaters state that you must use the Server Mods API for both checking and acquisition of file URLs for download. This class appears to use a third-party service and use of it would cause your file to be rejected on BukkitDev. I'd suggest having a read of the API documentation.
I checked the API out, but what I do not understand is how would you be able to check the latest version of the plugin? It doesnt show it anywhere in the Json link.
I still dont get why auto-updating is a thing. Use a proper plugin manager and dont let the plugins themselves auto-update. It just leads to instability.
well this basically just downloads and puts the jar into an update folder inside the plugins folder. the user just has to move it and restart. Skyost there isnt a way to check the updates unless you name the file in a specific way. A problem arises when the plugin author uploads it and names it incorrectly (like adding an extra space, or a typo). And also, I said it was Bukkit Approved mainly because I saw that TnT said it was "the only way we allow it" in here.