Automatic update class for your plugin - very lightweight

Discussion in 'Resources' started by Luloak2, Jul 30, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Luloak2

    I want to show you my automatic update class which I use in my plugins.

    It is very simple, just download the <Edit by Moderator: Redacted mediafire url>

    Then you have to change two things:
    * The first line of code must be changed to your package (that package where you dropped the Updater.java in). For example, if my package is called "me. Luloak2.FirstPlugin", then there must stand:
    Code:
    package me.Luloak2.FirstPlugin;
    * After all "import" lines you see this line:
    Code:
    public class Updater extends FirstPlugin
    You must change the "extends" to your main plugin class ( or wherever you are calling my Updater class from). For example, if I want to call it from "YourPlugin.java", the line looks so:
    Code:
    public class Updater extends YourPlugin
    Now you have to load up your finished plugin somewhere where my Updater can directly acces it, and you must load up a version.txt which you can change, thats important because the link in your plugin stays the same, so a new version must be set in the same file. Only write the version in your version.txt, here is an examplehow it should look like.
    My Updater can only handle simple doubles like in the example.

    Then, from where you want to update it, call it with this simple lines of code:
    Code:
    String version_location = "http://www.stormisland.de/Bukkit_Plugins/Godwalk/Version_Godwalk.txt";
    String plugin_location = "http://www.stormisland.de/Bukkit_Plugins/Godwalk/Godwalk.jar";
    Updater Updater = new Updater();
    Updater.update(version_location, plugin_location);
    In "version_location" has to be the direct link to your version.txt, in "plugin_location" the direct link to your plugin.


    I hope this tiny class will help you a lot if you want to update your plugins automatically.

    @Moderatos
    Please delete this Post, I posted it here in "Ressources", because there it sounds better than here;)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 10, 2016
  2. Offline

    TnT

    Moved to the plugin resources section.
     
  3. Offline

    Luloak2

    TnT
    Thx, but there is already the same thread, so delete this thread please or close it :)
     
Thread Status:
Not open for further replies.

Share This Page