Class AbstractGuizhanBuildsUpdater

java.lang.Object
net.guizhanss.guizhanlib.updater.AbstractGuizhanBuildsUpdater
Direct Known Subclasses:
GuizhanBuildsCNUpdater, GuizhanBuildsUpdater

public abstract class AbstractGuizhanBuildsUpdater extends Object
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 Details

    • AbstractGuizhanBuildsUpdater

      @ParametersAreNonnullByDefault protected AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch)
      This constructor sets up the updater.
      Parameters:
      plugin - The Plugin instance
      file - The File of plugin
      user - GitHub user
      repo - GitHub repository
      branch - GitHub branch
    • AbstractGuizhanBuildsUpdater

      @ParametersAreNonnullByDefault protected AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, UpdaterConfig updaterConfig)
      This constructor sets up the updater.
      Parameters:
      plugin - The Plugin instance
      file - The File of plugin
      user - GitHub user
      repo - GitHub repository
      branch - GitHub branch
      updaterConfig - The UpdaterConfig of updater.
    • AbstractGuizhanBuildsUpdater

      @Deprecated @ParametersAreNonnullByDefault protected AbstractGuizhanBuildsUpdater(Plugin plugin, File file, String user, String repo, String branch, boolean checkOnly)
      Deprecated.
      in favor of UpdaterConfig.
      This constructor sets up the updater.
      Parameters:
      plugin - The Plugin instance
      file - The File of plugin
      user - GitHub user
      repo - GitHub repository
      branch - GitHub branch
      checkOnly - Whether to check the version only, without downloading
    • 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.
      Parameters:
      plugin - The Plugin instance
      file - The File of plugin
      user - GitHub user
      repo - GitHub repository
      branch - GitHub branch
      checkOnly - Whether to check the version only, without downloading
      lang - The language of updater
  • Method Details

    • getBuildsURL

      @Nonnull public abstract String 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

      @Nonnull public abstract String 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

      @Nonnull public abstract String getLanguage()
      Override this method to set the language of updater.
      Returns:
      the language of updater
    • start

      public void start()
      Run updater task.
    • getReposFileURL

      @Nonnull public String getReposFileURL()
      Get the URL of repository list file (repos.json).
      Returns:
      the URL of repository list file
    • getRepoKey

      @Nonnull public String getRepoKey()
      Get the repository key in repos.json.
      Returns:
      the repository key
    • getBuildsInfo

      @Nonnull public String getBuildsInfo(@Nonnull String directory)
      Get the URL of builds information file (builds.json).
      Parameters:
      directory - Working directory
      Returns:
      the URL of builds information file
    • log

      public void log(Level level, String message, Object... args)
      Call the logger of plugin.
      Parameters:
      level - log Level
      message - the message
      args - the arguments
    • log

      public void log(Level level, Exception exception, String message, Object... args)
      Call the logger of plugin.
      Parameters:
      level - log Level
      exception - the Exception
      message - the message
      args - the arguments
    • log

      public void log(Level level, net.guizhanss.guizhanlib.updater.Locales key, Object... args)
      Call the logger of plugin.
      Parameters:
      level - log Level
      key - the message key
      args - the arguments
    • log

      public void log(Level level, Exception exception, net.guizhanss.guizhanlib.updater.Locales key, Object... args)
      Call the logger of plugin.
      Parameters:
      level - log Level
      exception - the Exception
      key - the message key
      args - the arguments
    • getTargetUrl

      @ParametersAreNonnullByDefault @Nonnull public String getTargetUrl(String directory, String target)
      Get the URL of the build artifact.
      Parameters:
      directory - Working directory
      target - Target filename
      Returns:
      the URL of the build artifact
    • getLocalizedString

      @ParametersAreNonnullByDefault @Nonnull public String getLocalizedString(net.guizhanss.guizhanlib.updater.Locales key)
      Get localized String.
      Parameters:
      key - The localization key.
      Returns:
      The localized String.