Package dev.deepcore.challenge
Class ChallengeSessionManager
java.lang.Object
dev.deepcore.challenge.ChallengeSessionManager
- All Implemented Interfaces:
ChallengeSessionWorldBridge
Coordinates challenge session state, player flow, and run lifecycle events.
-
Constructor Summary
ConstructorsConstructorDescriptionChallengeSessionManager(org.bukkit.plugin.java.JavaPlugin plugin, ChallengeManager challengeManager) Creates a session manager bound to plugin services and challenge state. -
Method Summary
Modifier and TypeMethodDescriptionvoidSynchronizes shared health/hunger immediately when shared-health mode is enabled.booleanReturns true when challenge settings are currently editable.voidEnds the current run and transitions back to prep mode.voidensurePrepBook(org.bukkit.entity.Player player) Ensures the prep guide book is present in a player's inventory.Returns the current challenge phase name in lowercase form.org.bukkit.LocationReturns the preferred lobby teleport location for session flows.intintvoidInitializes prep-mode state for currently online players.booleanbooleanbooleanbooleanpauseChallenge(org.bukkit.command.CommandSender sender) Pauses an active challenge and stores participant run snapshots.voidRebuilds the lobby preview hologram if no destroy animation is in progress.voidRegisters challenge listener classes bound to extracted domain services.voidResets run-specific state and returns all players to prep flow.booleanresumeChallenge(org.bukkit.command.CommandSender sender) Resumes a paused challenge and restores participant snapshots.voidsetRecordsService(RunRecordsService recordsService) voidsetWorldResetManager(WorldResetManager worldResetManager) voidshutdown()Stops scheduled tasks and clears transient state during plugin shutdown.voidApplies world gamerule and policy settings based on challenge configuration.
-
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 schedulingchallengeManager- challenge settings and component manager
-
-
Method Details
-
initialize
public void initialize()Initializes prep-mode state for currently online players. -
setWorldResetManager
-
setRecordsService
-
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
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:
resetForNewRunin interfaceChallengeSessionWorldBridge
-
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:
ensurePrepBookin interfaceChallengeSessionWorldBridge- 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:
refreshLobbyPreviewin interfaceChallengeSessionWorldBridge
-
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
-
getPreferredLobbyTeleportLocation
public org.bukkit.Location getPreferredLobbyTeleportLocation()Description copied from interface:ChallengeSessionWorldBridgeReturns the preferred lobby teleport location for session flows.- Specified by:
getPreferredLobbyTeleportLocationin interfaceChallengeSessionWorldBridge- Returns:
- destination location to use for lobby-bound teleports
-