Interface Queue


public interface Queue
Represents the queue for a single backend server.

A queue maintains an ordered list of players waiting to be transferred to the backend server. Players are ordered by priority (descending), then by join time (ascending) within the same priority tier.

  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    contains(@NotNull Player player)
    Returns true if the given player is currently in this queue.
    boolean
    contains(@NotNull UUID uniqueId)
    Returns true if the given UUID is currently in this queue.
    default void
    dequeue(@NotNull Player player)
    Removes a player from the queue.
    void
    dequeue(@NotNull UUID uniqueId)
    Removes a player from the queue by their UUID.
    void
    enqueue(@NotNull QueueEntryData data)
    Adds a player to this queue using explicit data.
    void
    enqueue(@NotNull Player player)
    Adds the given online player to this queue using their current permissions and priority.
    @NotNull @Unmodifiable Collection<? extends QueueEntry>
    Returns an immutable snapshot of all entries currently in this queue, in order.
    @Nullable QueueEntry
    getEntry(@NotNull UUID uniqueId)
    Returns the QueueEntry for the given player UUID, or null if not present.
    Returns the name of the backend server this queue targets.
    default Optional<Integer>
    getPosition(@NotNull Player player)
    Returns the one-based position of the given player in the queue, or Optional.empty() if the player is not present.
    getPosition(@NotNull UUID uniqueId)
    Returns the one-based position of the given player in the queue, or Optional.empty() if the player is not present.
    Returns the registered server instance this queue targets.
    @NotNull ServerStatus
    Returns the current status of the backend server.
    @NotNull QueueState
    Returns the current operational state of this queue.
    void
    setServerStatus(@NotNull ServerStatus status)
    Updates the status of the backend server.
    void
    setState(@NotNull QueueState state)
    Updates the operational state of this queue.
    int
    Returns the number of players currently in this queue.
    void
    Clears all players from this queue and releases any held resources.
  • Method Details

    • getName

      String getName()
      Returns the name of the backend server this queue targets.
      Returns:
      the server name
    • getServer

      RegisteredServer getServer()
      Returns the registered server instance this queue targets.
      Returns:
      the backend server
    • enqueue

      void enqueue(@NotNull @NotNull Player player)
      Adds the given online player to this queue using their current permissions and priority.
      Parameters:
      player - the player to enqueue
    • enqueue

      void enqueue(@NotNull @NotNull QueueEntryData data)
      Adds a player to this queue using explicit data.
      Parameters:
      data - the entry data describing the player to add
    • dequeue

      void dequeue(@NotNull @NotNull UUID uniqueId)
      Removes a player from the queue by their UUID.
      Parameters:
      uniqueId - the unique identifier of the player to remove
    • dequeue

      default void dequeue(@NotNull @NotNull Player player)
      Removes a player from the queue.
      Parameters:
      player - the player to remove
    • contains

      boolean contains(@NotNull @NotNull UUID uniqueId)
      Returns true if the given UUID is currently in this queue.
      Parameters:
      uniqueId - the player's UUID to check
      Returns:
      true if the player is queued
    • contains

      default boolean contains(@NotNull @NotNull Player player)
      Returns true if the given player is currently in this queue.
      Parameters:
      player - the player to check
      Returns:
      true if the player is queued
    • getEntry

      @Nullable @Nullable QueueEntry getEntry(@NotNull @NotNull UUID uniqueId)
      Returns the QueueEntry for the given player UUID, or null if not present.
      Parameters:
      uniqueId - the player's UUID
      Returns:
      the queue entry, or null
    • getEntries

      @NotNull @NotNull @Unmodifiable Collection<? extends QueueEntry> getEntries()
      Returns an immutable snapshot of all entries currently in this queue, in order.
      Returns:
      an ordered, immutable collection of queue entries
    • getPosition

      Optional<Integer> getPosition(@NotNull @NotNull UUID uniqueId)
      Returns the one-based position of the given player in the queue, or Optional.empty() if the player is not present.
      Parameters:
      uniqueId - the player's UUID
      Returns:
      the 1-based position, or Optional.empty()
    • getPosition

      default Optional<Integer> getPosition(@NotNull @NotNull Player player)
      Returns the one-based position of the given player in the queue, or Optional.empty() if the player is not present.
      Parameters:
      player - the player
      Returns:
      the 1-based position, or Optional.empty()
    • size

      int size()
      Returns the number of players currently in this queue.
      Returns:
      the queue size
    • getServerStatus

      @NotNull @NotNull ServerStatus getServerStatus()
      Returns the current status of the backend server.
      Returns:
      the server status
    • setServerStatus

      void setServerStatus(@NotNull @NotNull ServerStatus status)
      Updates the status of the backend server.
      Parameters:
      status - the new server status
    • getState

      @NotNull @NotNull QueueState getState()
      Returns the current operational state of this queue.
      Returns:
      the queue state
    • setState

      void setState(@NotNull @NotNull QueueState state)
      Updates the operational state of this queue.
      Parameters:
      state - the new queue state
    • teardown

      void teardown()
      Clears all players from this queue and releases any held resources.