Class UpdateManager

java.lang.Object
com.ultikits.ultitools.manager.UpdateManager

@Internal public class UpdateManager extends Object
Manages version checking and update notifications for UltiTools-API and modules. Checks once at startup, stores results for later querying by commands and listeners.
Since:
6.2.0
  • Field Details

    • logger

      private final Logger logger
    • frameworkUpdate

      private volatile UpdateInfo frameworkUpdate
    • moduleUpdates

      private final Map<String,UpdateInfo> moduleUpdates
    • notifiedPlayers

      private final Set<UUID> notifiedPlayers
      Players already notified about an available update, for the lifetime of this manager instance -- which is one server run: UltiTools.scheduleStartupMessages() builds a fresh UpdateManager exactly once per onEnable(), so a restart always starts from an empty set. Deliberately NOT @PlayerCache (#431): GEN-08/D-03 (plan 05-04) registered this field with PlayerCacheManager for quit-based sweeping to bound its size, but that made a quitting-and-rejoining player look never-notified within the SAME server run, breaking UpdateJoinListener's own documented promise of one notification per player per server session. The set's natural size bound is the number of distinct OP UUIDs that join this run, which does not grow on a repeat quit/rejoin of the same player -- there was no real unbounded-growth hazard here to trade the promise away for. Scoped to this field alone: the three other fields GEN-08/D-03 migrated onto PlayerCacheManager (in InMemoryNotificationService and InMemeryTeleportService) represent genuinely connection-scoped state and are untouched.
    • checkComplete

      private volatile boolean checkComplete
  • Constructor Details

    • UpdateManager

      public UpdateManager(Logger logger)
  • Method Details

    • checkUpdatesSync

      public void checkUpdatesSync()
      Run update checks synchronously. Called from async context (BukkitRunnable).
    • checkFrameworkUpdate

      private void checkFrameworkUpdate()
    • checkModuleUpdates

      private void checkModuleUpdates()
    • logResults

      private void logResults()
    • hasAnyUpdates

      public boolean hasAnyUpdates()
      Check if any updates (framework or modules) are available.
      Returns:
      true if any updates are available
    • isPlayerNotified

      public boolean isPlayerNotified(UUID uuid)
      Check if a player has already been notified about available updates.
      Parameters:
      uuid - the player's UUID
      Returns:
      true if the player has been notified
    • markPlayerNotified

      public void markPlayerNotified(UUID uuid)
      Mark a player as having been notified about available updates. The mark lives for this manager instance's lifetime (one server run) and is not cleared when the player quits (#431).
      Parameters:
      uuid - the player's UUID