Class SpectatorItemUseNextRoundEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
de.marcely.bedwars.api.event.player.SpectatorItemUseNextRoundEvent

public class SpectatorItemUseNextRoundEvent extends PlayerEvent
Gets called whenever a spectator uses the SpectatorItemHandlerType.NEXT_ROUND item.

This event is used to determine the arena the spectator shall attempt to join. Event is not called if SpectatorItemUseEvent is cancelled.

  • Constructor Details

  • Method Details

    • getSpectator

      public Spectator getSpectator()
      Returns the spectator who's trying to join.
      Returns:
      The involved spectator
    • getConsiderations

      public Collection<RemoteArena> getConsiderations()
      Get the arenas that are considered as the "next arena".

      By default, it only includes arenas that are in ArenaStatus.LOBBY status, aren't full, and have an equal RemoteArena.getCustomModeName().

      Further, if it doesn't result into no considerations, all arenas of an unequal mode (RemoteArena.getPlayersPerTeam()) get filtered out.

      Returns:
      The current considerations as a mutable collection
    • setConsiderations

      public void setConsiderations(Collection<RemoteArena> considerations)
      Set the new arenas to consider for.
      Parameters:
      considerations - The new viable options for the "next arena"
      See Also:
    • getBestOption

      @Nullable public @Nullable RemoteArena getBestOption()
      Gets the next arena the spectator shall attempt to join.

      Returns the arena with the greatest amount of players from getConsiderations(). Result might change if the considerations are modified within this event.

      Returns null if getConsiderations() is empty.

      Returns:
      The next "best" arena. null if there are no viable arenas
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()