Class PausedRunStateService

java.lang.Object
dev.deepcore.challenge.session.PausedRunStateService

public final class PausedRunStateService extends Object
Captures and restores player run state when pausing to lobby.
  • Constructor Details

    • PausedRunStateService

      public PausedRunStateService(double defaultMaxHealth)
      Creates a paused-run state service.
      Parameters:
      defaultMaxHealth - default max-health baseline used for snapshot restore
  • Method Details

    • clearSnapshots

      public void clearSnapshots()
      Clears all stored paused-run player snapshots.
    • stashRunStateForLobby

      public void stashRunStateForLobby(org.bukkit.entity.Player player, boolean teleportToLobby, Supplier<org.bukkit.Location> lobbySpawnSupplier)
      Captures a player's current run state and optionally teleports to lobby.
      Parameters:
      player - player whose state should be captured
      teleportToLobby - true to teleport player to lobby after snapshot
      lobbySpawnSupplier - supplier for lobby spawn location
    • applySnapshotIfPresent

      public void applySnapshotIfPresent(org.bukkit.entity.Player player)
      Applies a previously captured snapshot to the player when available.
      Parameters:
      player - player whose snapshot should be restored