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 to provide mirror URLs.
- Author:
- ybw0014
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThis constructor sets up the updater.protectedAbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, boolean checkOnly) Deprecated.protectedAbstractGuizhanBuildsUpdater(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).protectedAbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, UpdaterConfig updaterConfig) This constructor sets up the updater. -
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(net.guizhanss.guizhanlib.updater.Locales key) Get localizedString.abstract StringgetR2URL()Override this method to specify the R2 bucket URL.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.voidCall the logger of plugin.voidCall the logger of plugin.voidstart()Run updater task.
-
Constructor Details
-
AbstractGuizhanBuildsUpdater
@ParametersAreNonnullByDefault protected AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch) This constructor sets up the updater. -
AbstractGuizhanBuildsUpdater
@ParametersAreNonnullByDefault protected AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, UpdaterConfig updaterConfig) This constructor sets up the updater.- Parameters:
plugin- ThePlugininstancefile- TheFileof pluginuser- GitHub userrepo- GitHub repositorybranch- GitHub branchupdaterConfig- TheUpdaterConfigof updater.
-
AbstractGuizhanBuildsUpdater
@Deprecated @ParametersAreNonnullByDefault protected AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, boolean checkOnly) Deprecated.in favor ofUpdaterConfig.This constructor sets up the updater. -
AbstractGuizhanBuildsUpdater
@Deprecated @ParametersAreNonnullByDefault protected 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
-
getR2URL
Override this method to specify the R2 bucket URL.No trailing slash is needed.
Example:
https://builds-r2.gzassets.net- Returns:
- The R2 bucket URL
-
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. -
log
Call the logger of plugin.- Parameters:
level- logLevelkey- the message keyargs- the arguments
-
log
public void log(Level level, Exception exception, net.guizhanss.guizhanlib.updater.Locales key, Object... args) 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(net.guizhanss.guizhanlib.updater.Locales key) Get localizedString.- Parameters:
key- The localization key.- Returns:
- The localized
String.
-
UpdaterConfig.