Contents
- Description
- Nested Class Summary
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- checkForUpdate(String)
- downloadUpdate(UpdateService.VersionManifest, Path, UpdateService.ProgressCallback)
- performBootstrapInstall(UpdateService.VersionManifest, UpdateService.ProgressCallback)
- getEffectivePatchline()
- isValidUpdateLayout()
- getStagingDir()
- getBackupDir()
- getStagedVersion()
- deleteStagedUpdate()
- deleteBackupDir()
- readVersionFromJar(Path)
- fetchPatchlines(String)
Class UpdateService
java.lang.Object
com.hypixel.hytale.server.core.update.UpdateService
HTTP client for checking and downloading server updates.
Uses the same API as the downloader tool with OAuth authentication.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDownload task handle for cancellation.static classstatic classSummary of a patchline returned by the get-patchlines endpoint.static interfaceProgress callback for download operations.static classVersion manifest from the update service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckForUpdate(String patchline) Checks for available updates.static booleanDeletes the backup directory.static booleanDeletes the staged update.downloadUpdate(UpdateService.VersionManifest manifest, Path stagingDir, UpdateService.ProgressCallback progressCallback) Downloads an update to the staging directory.fetchPatchlines(String accessToken) Fetches accessible patchlines from the account-data service.static Pathstatic StringGets the effective patchline from config, falling back to manifest, then "release".static StringGets the version of the staged update.static Pathstatic booleanChecks if the server is running in the expected folder layout for updates.performBootstrapInstall(UpdateService.VersionManifest manifest, UpdateService.ProgressCallback progressCallback) First-run install.static StringreadVersionFromJar(Path jarPath) Reads the version from a JAR file's manifest.
-
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 infostagingDir- The directory to extract the update toprogressCallback- 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, andServer/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
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
-
getBackupDir
-
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
-
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:
IOExceptionInterruptedException
-