Package net.guizhanss.guizhanlib.updater
Class AbstractGuizhanBuildsUpdater
java.lang.Object
net.guizhanss.guizhanlib.updater.AbstractGuizhanBuildsUpdater
- Direct Known Subclasses:
GuizhanBuildsCNUpdater,GuizhanBuildsUpdater
The Guizhan Builds Updater is responsible to auto-update the plugin from
Guizhan Builds (builds.guizhanss.net).
This class can be extended for mirror URLs.
- Author:
- ybw0014
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, boolean checkOnly) This constructor sets up the updater.AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, boolean checkOnly, String lang) Deprecated.The language option is no longer used, since it is now configured under global config file (/plugins/GuizhanBuildsUpdater/config.yml). -
Method Summary
Modifier and TypeMethodDescriptiongetBuildsInfo(String directory) Get the URL of builds information file (builds.json).abstract StringOverride this method to specify the builds page's URL.abstract StringOverride this method to set the language of updater.getLocalizedString(String key, String defaultValue) Get localizedString.Get the repository key in repos.json.Get the URL of repository list file (repos.json).getTargetUrl(String directory, String target) Get the URL of the build artifact.voidCall the logger of plugin.voidCall the logger of plugin.voidstart()Run updater task.
-
Constructor Details
-
AbstractGuizhanBuildsUpdater
@ParametersAreNonnullByDefault public AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, boolean checkOnly) This constructor sets up the updater. -
AbstractGuizhanBuildsUpdater
@Deprecated @ParametersAreNonnullByDefault public AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, boolean checkOnly, String lang) Deprecated.The language option is no longer used, since it is now configured under global config file (/plugins/GuizhanBuildsUpdater/config.yml).This constructor sets up the updater.
-
-
Method Details
-
getBuildsURL
Override this method to specify the builds page's URL.No trailing slash is needed.
Example:
https://builds.guizhanss.net- Returns:
- the URL of builds page
-
getLanguage
Override this method to set the language of updater.- Returns:
- the language of updater
-
start
public void start()Run updater task. -
getReposFileURL
Get the URL of repository list file (repos.json).- Returns:
- the URL of repository list file
-
getRepoKey
Get the repository key in repos.json.- Returns:
- the repository key
-
getBuildsInfo
Get the URL of builds information file (builds.json).- Parameters:
directory- Working directory- Returns:
- the URL of builds information file
-
log
Call the logger of plugin.- Parameters:
level- logLevelmessage- the messageargs- the arguments
-
log
Call the logger of plugin. -
getTargetUrl
Get the URL of the build artifact.- Parameters:
directory- Working directorytarget- Target filename- Returns:
- the URL of the build artifact
-
getLocalizedString
@ParametersAreNonnullByDefault @Nonnull public String getLocalizedString(String key, String defaultValue) Get localizedString.- Parameters:
key- The localization keydefaultValue- The default value if localization is not found by key.- Returns:
- The localized
String.
-