Package us.ajg0702.queue.api.queues
Interface QueueServer
-
public interface QueueServer
Represents a server or a group that can be queued for
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
addPlayer(QueuePlayer player)
Adds a player to the end of the queue NOTE: It is reccomended to use QueueManager#addToQueuevoid
addPlayer(QueuePlayer player, int position)
Adds a player to the specified position in the queue NOTE: It is reccomended to use QueueManager#addToQueueboolean
canAccess(AdaptedPlayer ply)
If the player can access the server.default boolean
elliot_is_bad()
elliot is badQueuePlayer
findPlayer(java.lang.String player)
Finds the player in this queue and returns the representative QueuePlayerQueuePlayer
findPlayer(java.util.UUID uuid)
Finds the player with this uuid in this queue and returns the representative QueuePlayerQueuePlayer
findPlayer(AdaptedPlayer player)
Finds the player in this queue and returns the representative QueuePlayerjava.lang.String
getAlias()
The alias of this server.Balancer
getBalancer()
Gets the balancer this server is usingAdaptedServer
getIdealServer(AdaptedPlayer player)
Gets the most ideal server in this group to joinlong
getLastSentTime()
Gets how long since the last person was sentint
getManualMaxPlayers()
Gets the manually-set max player count for this server/groupjava.lang.String
getName()
Gets the name of the server/groupdefault int
getPosition(QueuePlayer player)
com.google.common.collect.ImmutableList<QueuePlayer>
getQueue()
Deprecated.It is recommended to not use this method unless you absolutely have to.QueueHolder
getQueueHolder()
Gets the QueueHolder for this queuecom.google.common.collect.ImmutableList<java.lang.String>
getServerNames()
Gets the names of the servers in this groupcom.google.common.collect.ImmutableList<AdaptedServer>
getServers()
Get the servers that this QueueServer representsjava.lang.String
getStatus()
Get the status of the server as a string (not from the messages file) Does not check if the player has access using restricted mode.java.lang.String
getStatus(AdaptedPlayer p)
Get the status of the server as a string (not from the messages file)java.lang.String
getStatusString()
Get the status of the server as a string.java.lang.String
getStatusString(AdaptedPlayer p)
Get the status of the server as a stringjava.util.List<java.lang.Integer>
getSupportedProtocols()
Gets the protocol versions this queue supports.boolean
isGroup()
Returns if this server is a groupboolean
isJoinable(AdaptedPlayer p)
Checks if the server is joinable by a playerboolean
isManuallyFull()
Checks if the total number of players in this server/group is above the manually-set max player countdefault boolean
isOnline()
Returns true if at least one server in the group is onlineboolean
isPaused()
Checks if the server is pausedvoid
removePlayer(AdaptedPlayer player)
Removes a player from the queuevoid
removePlayer(QueuePlayer player)
Removes a player from the queuevoid
sendPlayer()
Sends the first player in the queue to the servervoid
setLastSentTime(long lastSentTime)
Sets the time the last person was sentvoid
setPaused(boolean paused)
Pauses or unpauses a servervoid
setSupportedProtocols(java.util.List<java.lang.Integer> list)
Sets the protocols that are supported A blank list means all protocols are supported.
-
-
-
Method Detail
-
getQueue
@Deprecated com.google.common.collect.ImmutableList<QueuePlayer> getQueue()
Deprecated.It is recommended to not use this method unless you absolutely have to. If you have to, use getQueueHolder().getAllPlayers()Get the players who are queued.- Returns:
- The players who are queued
-
getStatusString
java.lang.String getStatusString(AdaptedPlayer p)
Get the status of the server as a string- Parameters:
p
- The player that you are checking for. Used for checking restricted servers- Returns:
- The status of the server as a string
-
getStatusString
java.lang.String getStatusString()
Get the status of the server as a string. Does not check if the player has access using restricted mode. May show online if it is restricted- Returns:
- The status of the server as a string
-
getStatus
java.lang.String getStatus(AdaptedPlayer p)
Get the status of the server as a string (not from the messages file)- Parameters:
p
- The player that you are checking for. Used for checking restricted servers- Returns:
- The status of the server as a string
-
getStatus
java.lang.String getStatus()
Get the status of the server as a string (not from the messages file) Does not check if the player has access using restricted mode. May show online if it is restricted- Returns:
- The status of the server as a string
-
getLastSentTime
long getLastSentTime()
Gets how long since the last person was sent- Returns:
- The number of miliseconds since the last person was sent
-
setLastSentTime
void setLastSentTime(long lastSentTime)
Sets the time the last person was sent- Parameters:
lastSentTime
- the time the last person was sent
-
isJoinable
boolean isJoinable(AdaptedPlayer p)
Checks if the server is joinable by a player- Parameters:
p
- The player to see if they can join- Returns:
- If the server is joinable
-
getManualMaxPlayers
int getManualMaxPlayers()
Gets the manually-set max player count for this server/group- Returns:
- The manually-set max player count
-
isManuallyFull
boolean isManuallyFull()
Checks if the total number of players in this server/group is above the manually-set max player count- Returns:
- If the server is at or above the manually-set player limit
-
setPaused
void setPaused(boolean paused)
Pauses or unpauses a server- Parameters:
paused
- true = paused, false = unpaused
-
isPaused
boolean isPaused()
Checks if the server is paused- Returns:
- True if the server is paused, false if its not
-
removePlayer
void removePlayer(QueuePlayer player)
Removes a player from the queue- Parameters:
player
- The player to remove
-
removePlayer
void removePlayer(AdaptedPlayer player)
Removes a player from the queue- Parameters:
player
- The player to remove
-
addPlayer
void addPlayer(QueuePlayer player)
Adds a player to the end of the queue NOTE: It is reccomended to use QueueManager#addToQueue- Parameters:
player
- The QueuePlayer t add
-
addPlayer
void addPlayer(QueuePlayer player, int position)
Adds a player to the specified position in the queue NOTE: It is reccomended to use QueueManager#addToQueue- Parameters:
player
- The QueuePlayer to addposition
- The position to add them
-
sendPlayer
void sendPlayer()
Sends the first player in the queue to the server
-
getName
java.lang.String getName()
Gets the name of the server/group- Returns:
- The name of the server/group
-
canAccess
boolean canAccess(AdaptedPlayer ply)
If the player can access the server. (Bungeecord's restricted servers) If on a platform that doesnt have restricted servers, this will always return true.- Parameters:
ply
- The player- Returns:
- True if the player can join based on bungeecord's restricted servers system
-
getAlias
java.lang.String getAlias()
The alias of this server. For displaying.- Returns:
- The alias of this server
-
getServers
com.google.common.collect.ImmutableList<AdaptedServer> getServers()
Get the servers that this QueueServer represents- Returns:
- A list of servers that this QueueServer represents
-
getServerNames
com.google.common.collect.ImmutableList<java.lang.String> getServerNames()
Gets the names of the servers in this group- Returns:
- A list of names
-
isOnline
default boolean isOnline()
Returns true if at least one server in the group is online- Returns:
- true if the server is online
-
isGroup
boolean isGroup()
Returns if this server is a group- Returns:
- True if this server is a group
-
findPlayer
QueuePlayer findPlayer(java.lang.String player)
Finds the player in this queue and returns the representative QueuePlayer- Returns:
- The QueuePlayer representing the player, null if not found
-
findPlayer
QueuePlayer findPlayer(AdaptedPlayer player)
Finds the player in this queue and returns the representative QueuePlayer- Returns:
- The QueuePlayer representing the player, null if not found
-
findPlayer
QueuePlayer findPlayer(java.util.UUID uuid)
Finds the player with this uuid in this queue and returns the representative QueuePlayer- Returns:
- The QueuePlayer representing the player, null if not found
-
getIdealServer
AdaptedServer getIdealServer(AdaptedPlayer player)
Gets the most ideal server in this group to join- Parameters:
player
- The player that would be joining- Returns:
- The ideal server to join
-
getSupportedProtocols
java.util.List<java.lang.Integer> getSupportedProtocols()
Gets the protocol versions this queue supports. A blank list means all protocols are supported.- Returns:
- The protocol versions this queue supports
-
setSupportedProtocols
void setSupportedProtocols(java.util.List<java.lang.Integer> list)
Sets the protocols that are supported A blank list means all protocols are supported.- Parameters:
list
- the list of protocols that are supported
-
getBalancer
Balancer getBalancer()
Gets the balancer this server is using- Returns:
- The balancer this server is using
-
getQueueHolder
QueueHolder getQueueHolder()
Gets the QueueHolder for this queue- Returns:
- the QueueHolder that holds the queue
-
getPosition
default int getPosition(QueuePlayer player)
-
elliot_is_bad
default boolean elliot_is_bad()
elliot is bad- Returns:
- true because elliot is bad
-
-