because i wanted to have an automatic Updater for my Plugin, i made following class to make it easier and i want to share it with you.
To have an automatic download you need to have your own Webspace(/Website) because i cant get the plugin out of the Spigot forum, because it is blocked because of the DDos Protection i think.
You can get a free Website at www.bplaced.net for example.
1. Implement Updater
At first you have to download the API Jarfile and add it like any other API.
In your onEnable() Method you write :
2. Create the HTML-Information FileCode (Text):SpigotPluginUpdater spu = new SpigotPluginUpdater(this/*Your Plugin*/, "http://www.yourdomain.com/plugin[or your plugin name].html");
spu.enableOut(); // Enables an Output if there is a new Update and if the file was downloaded
//spu.disableOut(); Disables the output
if(spu.needsUpdate()) // Check if there is an Update availible
Now to the plugin[or your plugin name].html:
Just save this HTML-File in your webspace.Code (Text):
<p>Plugin.jar[File name, or URL(see Step "External Jar")]</p>
Changes: [Changelog which will be displayed in console]
- update version
3. Update the Plugin
3.1 External JarCode (Text):
// When you want to update your Plugin which is in the same folder as your plugin.html[or so]:
spu.update(); // The Plugin will be automatically update
If your Plugin.jar isnt in the same Folder as your plugin.html replace the plugin.jar in the html file with your external URL to you Plugin.jar.
Now to update the Plugin:
Plugins which use AutoUpdater:
- (write me if you use it and I will add it here)
(If you want to use the code directly inside your Plugin too you have to credit me on the Plugin Page and in the code!
If there are Bugs or something else, post in discussion or send me a pm.