[API] PluginUpdater [With Website]
SpigotMCAuto update your Plugin
2.4k загрузок 5.0 рейтинг
последняя v2.0 SpigotMC
Hello,
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 File
Now to the plugin[or your plugin name].html:
<html>
<item>
<h1>v1.0 [Version]</h1>
<p>Plugin.jar[File name, or URL(see Step "External Jar")]</p>
<p>
Changes: [Changelog which will be displayed in console]
- update version
</p>
</item>
</html>
Just save this HTML-File in your webspace.
3. Update the Plugin
// 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
3.1 External Jar
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:
spu.externalUpdate();
At first you have to download the API Jarfile and add it like any other API.
In your onEnable() Method you write :
Code (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
//...
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:
Code (Text):
<html>
<item>
<h1>v1.0 [Version]</h1>
<p>Plugin.jar[File name, or URL(see Step "External Jar")]</p>
<p>
Changes: [Changelog which will be displayed in console]
- update version
</p>
</item>
</html>
3. Update the Plugin
Code (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:
Code (Text):
spu.externalUpdate();
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!
Class: http://www.stealth-coders.de/downloads/SpigotPluginUpdater.java
If there are Bugs or something else, post in discussion or send me a pm.
Thanks,
Bentipa
Комментарии 0
Пока нет комментариев. Будь первым, кто поделится мнением.