Class UpdateModule

All Implemented Interfaces:
CommandOwner

public class UpdateModule extends JavaPlugin
Module responsible for managing server updates.

Features:

  • Periodic update checks (configurable interval)
  • Console and player notifications when updates are available
  • Staged update warnings for direct JAR execution
  • Reminder messages for pending staged updates
  • Field Details

    • MANIFEST

      @Nonnull public static final PluginManifest MANIFEST
    • KILL_SWITCH_ENABLED

      public static final boolean KILL_SWITCH_ENABLED
  • Constructor Details

  • Method Details

    • get

      @Nullable public static UpdateModule get()
    • onServerReady

      public void onServerReady()
      Called after server boot is complete to show post-boot reminder.
    • getLatestKnownVersion

      @Nullable public UpdateService.VersionManifest getLatestKnownVersion()
      Gets the latest known version from the last check.
    • setLatestKnownVersion

      public void setLatestKnownVersion(@Nullable UpdateService.VersionManifest version)
      Sets the latest known version (called after any update check).
    • isDownloadInProgress

      public boolean isDownloadInProgress()
      Checks if a download is currently in progress.
    • tryAcquireDownloadLock

      public boolean tryAcquireDownloadLock()
      Attempts to acquire the download lock and start a download. This is thread-safe and prevents multiple concurrent downloads.
      Returns:
      true if the lock was acquired, false if a download is already in progress
    • setActiveDownload

      public void setActiveDownload(@Nullable CompletableFuture<?> download, @Nullable Thread thread)
      Sets the active download future for tracking and cancellation. Should be called after tryAcquireDownloadLock() returns true.
    • releaseDownloadLock

      public void releaseDownloadLock()
      Releases the download lock. Must be called when download completes or fails.
    • updateDownloadProgress

      public void updateDownloadProgress(long downloaded, long total)
      Updates the download progress. Called from download callbacks.
    • getDownloadProgress

      @Nullable public UpdateModule.DownloadProgress getDownloadProgress()
      Gets the current download progress, or null if no download is active.
    • cancelDownload

      public boolean cancelDownload()
      Cancels the active download if one is in progress.
      Returns:
      true if a download was cancelled