Skip to content
This repository has been archived by the owner on Jul 4, 2022. It is now read-only.

Utils Updater

Nico edited this page Sep 26, 2020 · 8 revisions

Updater

SimplixCore offers a way for automatic update checks and automatic update installation. This works for every SimplixAppliaction so like SimplixLibraries and Plugins. This will not work for standalone applications.

The update policy

If you want to benefit from SimplixCore's version checking, you need to place a updatepolicy.json file into your resources folder. The file looks like that:

{  
  "versionPattern": "regex-here",
  "versionFetcherClass": "dev.simplix.core.common.updater.SpigotMcResourceVersionFetcher",  
  "versionFetcher": {  
    "resourceId": "63778"  
  },  
  "downloaderClass": "dev.simplix.core.common.updater.UrlUpdateDownloader",  
  "downloader": {
    "url": "https://my-file-host.com/myplugin/latest.jar"  
  }  
}

versionPattern: Optional, only needed when using a non standard versioning scheme.

versionFetcherClass: Required, the class that will be used for querying the latest version number.

versionFetcher: Required, a serialized instance of the VersionFetcher class.

updateDownloaderClass: Optional, only needed if you want to automatically download the update file. The class that is beeing used for downloading the update.

updateDownloader: Optional, only needed if you want to automatically download the update file. A serialized instance of the UpdateDownloader class.

Available version fetchers

Class Purpose
dev.simplix.core.common.updater.SpigotMcResourceVersionFetcher This will fetch the latest version number from a provided SpigotMC.org resource identified with its resourceId
dev.simplix.core.common.updater.UrlVersionFetcher This will fetch the latest version number from a provided url. The response has to be plain text.

Available update downloaders

Class Purpose
dev.simplix.core.common.updater.UrlUpdateDownloader This downloads a binary file from a provided url