Class UpdateService

java.lang.Object
com.hypixel.hytale.server.core.update.UpdateService

public class UpdateService extends Object
HTTP client for checking and downloading server updates. Uses the same API as the downloader tool with OAuth authentication.
  • Constructor Details

    • UpdateService

      public UpdateService()
  • Method Details

    • checkForUpdate

      @Nullable public CompletableFuture<UpdateService.VersionManifest> checkForUpdate(@Nonnull String patchline)
      Checks for available updates.
      Parameters:
      patchline - The patchline to check (e.g., "release")
      Returns:
      The version manifest if successful, null otherwise
    • downloadUpdate

      public UpdateService.DownloadTask downloadUpdate(@Nonnull UpdateService.VersionManifest manifest, @Nonnull Path stagingDir, @Nullable UpdateService.ProgressCallback progressCallback)
      Downloads an update to the staging directory.
      Parameters:
      manifest - The version manifest containing download info
      stagingDir - The directory to extract the update to
      progressCallback - Optional callback for download progress (percent, bytesDownloaded, totalBytes)
      Returns:
      true if download and extraction succeeded
    • performBootstrapInstall

      public UpdateService.DownloadTask performBootstrapInstall(@Nonnull UpdateService.VersionManifest manifest, @Nullable UpdateService.ProgressCallback progressCallback)
      First-run install. Downloads the payload for the given manifest and extracts it directly into the current working directory, producing the expected update layout (Assets.zip, start.sh/start.bat, and Server/HytaleServer.jar). The live-update flow has to extract to a staging dir so world saves and config aren't clobbered; bootstrap assumes the cwd contains only the installer JAR, so writing directly into it is safe and produces the layout the launcher scripts expect.
    • getEffectivePatchline

      @Nonnull public static String getEffectivePatchline()
      Gets the effective patchline from config, falling back to manifest, then "release".
    • isValidUpdateLayout

      public static boolean isValidUpdateLayout()
      Checks if the server is running in the expected folder layout for updates. Expected: Assets.zip and start.sh/bat in parent directory.
    • getStagingDir

      @Nonnull public static Path getStagingDir()
    • getBackupDir

      @Nonnull public static Path getBackupDir()
    • getStagedVersion

      @Nullable public static String getStagedVersion()
      Gets the version of the staged update.
      Returns:
      The staged version, or null if no staged update
    • deleteStagedUpdate

      public static boolean deleteStagedUpdate()
      Deletes the staged update.
    • deleteBackupDir

      public static boolean deleteBackupDir()
      Deletes the backup directory.
    • readVersionFromJar

      @Nullable public static String readVersionFromJar(@Nonnull Path jarPath)
      Reads the version from a JAR file's manifest.
      Parameters:
      jarPath - Path to the JAR file
      Returns:
      The version string, or null if not found
    • fetchPatchlines

      @Nullable public UpdateService.PatchlineSummary[] fetchPatchlines(@Nonnull String accessToken) throws IOException, InterruptedException
      Fetches accessible patchlines from the account-data service.
      Parameters:
      accessToken - OAuth access token
      Returns:
      list of patchline summaries, or null on failure
      Throws:
      IOException
      InterruptedException