-
Notifications
You must be signed in to change notification settings - Fork 1
Sync Default Configuration
Adamki11s edited this page Jan 29, 2012
·
1 revision
Sync Default Configuration aims to provide a quick and easy way to create a configuration so server administrators can control the way your plugin handles updates.
Create the default configuration like so.
File f = new File("plugins" + File.seperator + "Sync" + File.seperator + "config.txt");
SyncDefaultConfiguration config = new SyncDefaultConfiguration(f);
config.setAutoDownloadUpdates(boolean value);
config.setCheckForUpdates(boolean value);
config.setReloadAfterUpdate(boolean value);
config.setUpdatePath(String path);
config.write();
You can only set your plugin to reload after an update if your download path is set to : plugins/Update/pluginname.jar This is to prevent unlimited reloads as Sync would download the newest version of your plugin and reload the server and the version would still be outdated causing an endless loop.
Once you have a configuration created it is easy enough to get the data from it.
File f = new File("plugins" + File.seperator + "Sync" + File.seperator + "config.txt");
SyncDefaultConfiguration config = new SyncDefaultConfiguration(f);
SyncConfigurationData data = config.read();
From the SyncConfigurationData class you can check all the values such as autoDownloadingUpdates, checkForUpdates, setReloadAfterUpdate and setUpdatePath.