Interface BattleSpectating

All Known Subinterfaces:
BattleController, BattleMessaging
All Known Implementing Classes:
MultiLaneBattleController, StandardBattleController

public interface BattleSpectating
Provides spectator access and management for a battle.

Spectators are players who are observing a battle without participating in it. This interface exposes the current spectator list and the operations used to add, query, and remove spectators.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isSpectating(net.minecraft.world.entity.player.Player player)
    Returns whether the specified player is currently spectating this battle.
    boolean
    removeSpectator(net.minecraft.server.level.ServerPlayer player)
    Removes a player from this battle's spectators.
    void
    spectate(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.entity.Entity target)
    Adds a player as a spectator of this battle.
    Returns the spectators currently watching this battle.
  • Method Details

    • spectators

      List<Spectator> spectators()
      Returns the spectators currently watching this battle.

      The returned list may be backed by the live battle state. Callers should avoid mutating it directly unless they are part of battle-controller internals.

      Returns:
      the current battle spectators
    • spectate

      void spectate(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.entity.Entity target)
      Adds a player as a spectator of this battle.

      The target entity is used as the entity the player is spectating from or tracking when they begin watching the battle.

      Parameters:
      player - the player to add as a spectator
      target - the battle-related entity being spectated or tracked
    • isSpectating

      boolean isSpectating(net.minecraft.world.entity.player.Player player)
      Returns whether the specified player is currently spectating this battle.
      Parameters:
      player - the player to check
      Returns:
      true if the player is spectating this battle; false otherwise
    • removeSpectator

      boolean removeSpectator(net.minecraft.server.level.ServerPlayer player)
      Removes a player from this battle's spectators.
      Parameters:
      player - the spectator to remove
      Returns:
      true if the player was spectating this battle and was removed; false otherwise