Package com.btcvelocity.api.queue
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 TypeMethodDescriptiondefault booleanReturnstrueif the given player is currently in this queue.booleanReturnstrueif the given UUID is currently in this queue.default voidRemoves a player from the queue.voidRemoves a player from the queue by their UUID.voidenqueue(@NotNull QueueEntryData data) Adds a player to this queue using explicit data.voidAdds 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 QueueEntryReturns theQueueEntryfor the given player UUID, ornullif not present.getName()Returns the name of the backend server this queue targets.getPosition(@NotNull Player player) Returns the one-based position of the given player in the queue, orOptional.empty()if the player is not present.getPosition(@NotNull UUID uniqueId) Returns the one-based position of the given player in the queue, orOptional.empty()if the player is not present.Returns the registered server instance this queue targets.@NotNull ServerStatusReturns the current status of the backend server.@NotNull QueueStategetState()Returns the current operational state of this queue.voidsetServerStatus(@NotNull ServerStatus status) Updates the status of the backend server.voidsetState(@NotNull QueueState state) Updates the operational state of this queue.intsize()Returns the number of players currently in this queue.voidteardown()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
Adds the given online player to this queue using their current permissions and priority.- Parameters:
player- the player to enqueue
-
enqueue
Adds a player to this queue using explicit data.- Parameters:
data- the entry data describing the player to add
-
dequeue
Removes a player from the queue by their UUID.- Parameters:
uniqueId- the unique identifier of the player to remove
-
dequeue
Removes a player from the queue.- Parameters:
player- the player to remove
-
contains
Returnstrueif the given UUID is currently in this queue.- Parameters:
uniqueId- the player's UUID to check- Returns:
trueif the player is queued
-
contains
Returnstrueif the given player is currently in this queue.- Parameters:
player- the player to check- Returns:
trueif the player is queued
-
getEntry
Returns theQueueEntryfor the given player UUID, ornullif not present.- Parameters:
uniqueId- the player's UUID- Returns:
- the queue entry, or
null
-
getEntries
Returns an immutable snapshot of all entries currently in this queue, in order.- Returns:
- an ordered, immutable collection of queue entries
-
getPosition
Returns the one-based position of the given player in the queue, orOptional.empty()if the player is not present.- Parameters:
uniqueId- the player's UUID- Returns:
- the 1-based position, or
Optional.empty()
-
getPosition
Returns the one-based position of the given player in the queue, orOptional.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
Returns the current status of the backend server.- Returns:
- the server status
-
setServerStatus
Updates the status of the backend server.- Parameters:
status- the new server status
-
getState
Returns the current operational state of this queue.- Returns:
- the queue state
-
setState
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.
-