Klasse SpectateManager

java.lang.Object
de.delinkedde.mobarenareborn.session.SpectateManager

public final class SpectateManager extends Object
Lets outside players watch a running round from the spectator warp.

Spectating is deliberately lightweight: the watcher keeps their inventory and is only switched to spectator mode and teleported. Their previous position, game mode and flight state are held in memory and restored when they stop watching, when they disconnect, or when the watched round ends. Watchers are not session participants: they earn nothing, cannot be targeted and do not count towards the wave scaling.

  • Konstruktordetails

    • SpectateManager

      public SpectateManager(@NotNull @NotNull SessionManager sessions)
      Parameter:
      sessions - the session manager, used to check for running rounds
  • Methodendetails

    • spectate

      @NotNull public @NotNull SpectateManager.SpectateResult spectate(@NotNull @NotNull Player player, @NotNull @NotNull Arena arena)
      Puts a player into watch mode for an arena's running round.
      Parameter:
      player - the watcher
      arena - the arena to watch
      Gibt zurück:
      the outcome
    • stop

      public boolean stop(@NotNull @NotNull Player player)
      Stops a player from watching and restores their previous state.
      Parameter:
      player - the watcher
      Gibt zurück:
      true if the player was watching
    • isSpectating

      public boolean isSpectating(@NotNull @NotNull Player player)
      Parameter:
      player - the player
      Gibt zurück:
      whether the player is currently watching a round
    • stopAllFor

      public void stopAllFor(@NotNull @NotNull String arenaName)
      Returns every watcher of the given arena to their previous state. Called when the watched round ends.
      Parameter:
      arenaName - the arena identifier