Skip to content
Adamki11s edited this page Jan 30, 2012 · 3 revisions

< Home

Sync Updates provides you with an easy way to control versions of your plugins and keep admins up to date with the latest updates for your plugin.

How to register an update service. You first have to create an UpdatePackage which can then be added as an UpdateService.

Update Service


UpdatePackage pack;

public void onEnable(){
    Plugin p = this;
    String websiteURL = "http://www.somelinktoapage.com/";
    boolean autoDownloadUpdates = true;
    boolean reloadAfterUpdate = false;
    File downloadLocation = new File("plugins" + File.seperator + "SomeFolder" + File.seperator + "Name.jar");
    pack = new UpdatePackage(p, websiteURL, autoDownloadUpdates, reloadAfterUpdate, downloadLocation);
    try {
        UpdateService.registerUpdateService(pack); //try and register our update service. Only 1 allowed per plugin
        //Sync will handle the rest.
    } catch (MultipleUpdatePackageException e1) {
        e1.printStackTrace();
    }
}

Web Page Data

Once you have your UpdatePackage configured and setup you need to setup the web side of things. Sync will load the source of the webpage specified and will parse it to find the version headers of Sync version, download and changelog. You must include these headers in the website (unformatted) or Sync will not be able to update your plugin. I recommend putting these headers inside your Bukkit post as it is easy to modify that way.

Headers


(Sync_Version=1.0.0) - Version must be at least x.y where x and y are integers. Eg (Sync_Version=1) will not work. (Sync_Version=1.0) will work.

(Sync_Download=downloadlink) - This is the download link for the updated version of your plugin. Do not put http://www. as this will mess with the parsing of the update link.

(Sync_Changelog=Changed this and that etc...) - Anything can go here.


Example:


(Sync_Version=1.0.0)

(Sync_Download=dl.dropbox.com/u/27260323/Steps.jar)

(Sync_Changelog=Added Step Counting!)