Package com.tomkeuper.bedwars.api
Interface BedWars.ArenaUtil
- Enclosing interface:
BedWars
public static interface BedWars.ArenaUtil
The ArenaUtil interface provides utility methods for managing arenas in the bed wars mini-game.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a custom arena to the enable queue.boolean
canAutoScale
(String arenaName) Checks if an arena can be auto-scaled.getArenaByIdentifier
(String identifier) Retrieves an arena by its identifier.getArenaByName
(String worldName) Retrieves an arena by its world name.getArenaByPlayer
(org.bukkit.entity.Player player) Retrieves the arena where the player is located (either as a spectator or a player).Retrieves a list of all arenas.Retrieves the enable queue of arenas.int
Gets the number of games before the server restarts.int
getPlayers
(String group) Retrieves the number of players in a specific group.boolean
isPlaying
(org.bukkit.entity.Player p) Checks if a player is currently playing in an arena.boolean
isSpectating
(org.bukkit.entity.Player p) Checks if a player is currently spectating in an arena.boolean
joinRandomArena
(org.bukkit.entity.Player p) Adds a player to the most filled arena.boolean
joinRandomFromGroup
(org.bukkit.entity.Player p, String group) Adds a player to the most filled arena from a specific group.void
Loads an arena and adds it to the enable queue.void
removeArenaByName
(String worldName) Removes the association of an arena with its world name.void
removeArenaByPlayer
(org.bukkit.entity.Player p, IArena a) Removes the association of an arena with a player.void
Removes an arena from the enable queue.void
sendLobbyCommandItems
(org.bukkit.entity.Player p) Gives the lobby items to the player.void
setArenaByName
(IArena arena) Sets the arena using its world name.void
setArenaByPlayer
(org.bukkit.entity.Player p, IArena arena) Sets the arena for a player if the player is in the specified arena.void
setGamesBeforeRestart
(int games) Sets the number of games before the server restarts.boolean
vipJoin
(org.bukkit.entity.Player p) Checks if a player has VIP join access.
-
Method Details
-
canAutoScale
Checks if an arena can be auto-scaled.- Parameters:
arenaName
- the name of the arena- Returns:
- true if the arena can be auto-scaled, false otherwise
-
addToEnableQueue
Adds a custom arena to the enable queue.- Parameters:
a
- the arena to add
-
removeFromEnableQueue
Removes an arena from the enable queue.- Parameters:
a
- the arena to remove
-
isPlaying
boolean isPlaying(org.bukkit.entity.Player p) Checks if a player is currently playing in an arena.- Parameters:
p
- the player- Returns:
- true if the player is playing, false otherwise
-
isSpectating
boolean isSpectating(org.bukkit.entity.Player p) Checks if a player is currently spectating in an arena.- Parameters:
p
- the player- Returns:
- true if the player is spectating, false otherwise
-
loadArena
Loads an arena and adds it to the enable queue.- Parameters:
worldName
- the name of the arena worldsender
- the player or console who triggered the load (can be null)
-
setGamesBeforeRestart
void setGamesBeforeRestart(int games) Sets the number of games before the server restarts. This is only applicable in a BUNGEE server type.- Parameters:
games
- the number of games before restart
-
getGamesBeforeRestart
int getGamesBeforeRestart()Gets the number of games before the server restarts. This is only applicable in a BUNGEE server type.- Returns:
- the number of games before restart
-
getArenaByPlayer
Retrieves the arena where the player is located (either as a spectator or a player).- Parameters:
player
- the player- Returns:
- the arena where the player is located, or null if not in an arena
-
setArenaByPlayer
Sets the arena for a player if the player is in the specified arena.- Parameters:
p
- the playerarena
- the arena
-
removeArenaByPlayer
Removes the association of an arena with a player.- Parameters:
p
- the playera
- the arena
-
getArenaByName
Retrieves an arena by its world name.- Parameters:
worldName
- the world name of the arena- Returns:
- the arena with the specified world name, or null if not found
-
getArenaByIdentifier
Retrieves an arena by its identifier.- Parameters:
identifier
- the identifier of the arena- Returns:
- the arena with the specified identifier, or null if not found
-
setArenaByName
Sets the arena using its world name.- Parameters:
arena
- the arena to set
-
removeArenaByName
Removes the association of an arena with its world name.- Parameters:
worldName
- the world name of the arena to remove
-
getArenas
LinkedList<IArena> getArenas()Retrieves a list of all arenas.- Returns:
- the list of arenas
-
vipJoin
boolean vipJoin(org.bukkit.entity.Player p) Checks if a player has VIP join access.- Parameters:
p
- the player- Returns:
- true if the player has VIP join access, false otherwise
-
getPlayers
Retrieves the number of players in a specific group.- Parameters:
group
- the group name- Returns:
- the number of players in the group
-
joinRandomArena
boolean joinRandomArena(org.bukkit.entity.Player p) Adds a player to the most filled arena. Checks if the player is the party owner first.- Parameters:
p
- the player to add- Returns:
- true if the player joined an arena, false otherwise
-
joinRandomFromGroup
Adds a player to the most filled arena from a specific group.- Parameters:
p
- the player to addgroup
- the group name- Returns:
- true if the player joined an arena, false otherwise
-
getEnableQueue
LinkedList<IArena> getEnableQueue()Retrieves the enable queue of arenas.- Returns:
- the enable queue
-
sendLobbyCommandItems
void sendLobbyCommandItems(org.bukkit.entity.Player p) Gives the lobby items to the player. This clears the player's inventory before giving the items. (Not used for BUNGEE serverType)- Parameters:
p
- the player
-