Class ChallengeSessionManager

java.lang.Object
dev.deepcore.challenge.ChallengeSessionManager
All Implemented Interfaces:
ChallengeSessionWorldBridge

public final class ChallengeSessionManager extends Object implements ChallengeSessionWorldBridge
Coordinates challenge session state, player flow, and run lifecycle events.
  • Constructor Details

    • ChallengeSessionManager

      public ChallengeSessionManager(org.bukkit.plugin.java.JavaPlugin plugin, ChallengeManager challengeManager)
      Creates a session manager bound to plugin services and challenge state.
      Parameters:
      plugin - plugin root instance used for service wiring and scheduling
      challengeManager - challenge settings and component manager
  • Method Details

    • initialize

      public void initialize()
      Initializes prep-mode state for currently online players.
    • setWorldResetManager

      public void setWorldResetManager(WorldResetManager worldResetManager)
    • setRecordsService

      public void setRecordsService(RunRecordsService recordsService)
    • registerEventListeners

      public void registerEventListeners()
      Registers challenge listener classes bound to extracted domain services.
    • syncWorldRules

      public void syncWorldRules()
      Applies world gamerule and policy settings based on challenge configuration.
    • canEditSettings

      public boolean canEditSettings()
      Returns true when challenge settings are currently editable.
      Returns:
      true when the session is in prep phase
    • getPhaseName

      public String getPhaseName()
      Returns the current challenge phase name in lowercase form.
      Returns:
      lowercase session phase name
    • getReadyCount

      public int getReadyCount()
    • getReadyTargetCount

      public int getReadyTargetCount()
    • isPrepPhase

      public boolean isPrepPhase()
    • isRunningPhase

      public boolean isRunningPhase()
    • isPausedPhase

      public boolean isPausedPhase()
    • shutdown

      public void shutdown()
      Stops scheduled tasks and clears transient state during plugin shutdown.
    • resetForNewRun

      public void resetForNewRun()
      Resets run-specific state and returns all players to prep flow.
      Specified by:
      resetForNewRun in interface ChallengeSessionWorldBridge
    • endChallengeAndReturnToPrep

      public void endChallengeAndReturnToPrep()
      Ends the current run and transitions back to prep mode.
    • ensurePrepBook

      public void ensurePrepBook(org.bukkit.entity.Player player)
      Ensures the prep guide book is present in a player's inventory.
      Specified by:
      ensurePrepBook in interface ChallengeSessionWorldBridge
      Parameters:
      player - player to receive the prep guide book
    • refreshLobbyPreview

      public void refreshLobbyPreview()
      Rebuilds the lobby preview hologram if no destroy animation is in progress.
      Specified by:
      refreshLobbyPreview in interface ChallengeSessionWorldBridge
    • pauseChallenge

      public boolean pauseChallenge(org.bukkit.command.CommandSender sender)
      Pauses an active challenge and stores participant run snapshots.
      Parameters:
      sender - command sender initiating the pause
      Returns:
      true when pause operations complete successfully
    • resumeChallenge

      public boolean resumeChallenge(org.bukkit.command.CommandSender sender)
      Resumes a paused challenge and restores participant snapshots.
      Parameters:
      sender - command sender initiating the resume
      Returns:
      true when resume operations complete successfully
    • applySharedVitalsIfEnabled

      public void applySharedVitalsIfEnabled()
      Synchronizes shared health/hunger immediately when shared-health mode is enabled.
    • getPreferredLobbyTeleportLocation

      public org.bukkit.Location getPreferredLobbyTeleportLocation()
      Description copied from interface: ChallengeSessionWorldBridge
      Returns the preferred lobby teleport location for session flows.
      Specified by:
      getPreferredLobbyTeleportLocation in interface ChallengeSessionWorldBridge
      Returns:
      destination location to use for lobby-bound teleports