Package com.tomkeuper.bedwars.api.arena
Interface IArena
public interface IArena
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abandonGame
(org.bukkit.entity.Player player) Triggered when a player has abandoned a game.void
addPlacedBlock
(org.bukkit.block.Block block) Add a placed block to the cache.boolean
addPlayer
(org.bukkit.entity.Player p, boolean skipOwnerCheck) Add a player to the arenavoid
addPlayerBedDestroyed
(org.bukkit.entity.Player p) Add a bed destroyed event to the temporary statistics of a player.void
addPlayerDeath
(org.bukkit.entity.Player p) Add a player death to the temporary statistics.void
addPlayerKill
(org.bukkit.entity.Player p, boolean finalKill, org.bukkit.entity.Player victim) Add a player kill to the game statistics.void
addSign
(org.bukkit.Location loc) Add a join sign for the arena at the specified location.boolean
addSpectator
(org.bukkit.entity.Player p, boolean playerBefore, org.bukkit.Location staffTeleport) Add a player as Spectatorvoid
changeStatus
(GameState status) Change the game status of the arena and start the corresponding tasks.void
Check for a winner in the arena.void
This is used to destroy arena data when it restarts.void
disable()
Disable the arena.Get the announcement task for the arena.Get the used world name for the arena.@Nullable ITeam
getBedsTeam
(org.bukkit.Location location) Get the team that owns the bed at the specified location.Get the configuration manager for the arena.getDisplayGroup
(Language language) Get the arena display group for the given language.getDisplayGroup
(org.bukkit.entity.Player player) Get the arena display group for the given player.Get the arena name as a message that can be used on signs, etc.getDisplayStatus
(Language lang) Get the display status for the arena.List
<me.neznamy.tab.api.bossbar.BossBar> Get the list of dragon boss bars in the arena.Get the team the player played for in the current match.Gets the cooldowns for fireballs in the arena.getGroup()
Get the group of the arena.int
Get the radius of the islands in the arena.int
Get the time in seconds when the magic milk effect will expire.int
Get the maximum number of players allowed in a team.int
Get the maximum number of players allowed in the arena.Get the next event for the arena.Get the list of next events to come in the arena.Get the ore generators in the arena.LinkedList
<org.bukkit.util.Vector> Get a list of placed blocks in the arena.int
getPlayerBedsDestroyed
(org.bukkit.entity.Player p) Get the number of beds destroyed by a player.int
getPlayerDeaths
(org.bukkit.entity.Player p, boolean finalDeaths) Get the number of deaths for a specific player in the arena.int
getPlayerKills
(org.bukkit.entity.Player p, boolean finalKills) Get the number of kills for a player.List
<org.bukkit.entity.Player> Get a list of players currently in the arena.Get the playing task for the arena.Get the list of regions for the arena.int
Get the player's render distance in blocks.org.bukkit.Location
Get the re-spawning screen location.ConcurrentHashMap
<org.bukkit.entity.Player, Integer> Get a map of players in the respawn screen and their remaining time.Get the restarting task for the arena.ConcurrentHashMap
<org.bukkit.entity.Player, Integer> Get the show time map for armor invisibility.List
<org.bukkit.block.Block> getSigns()
Get the join signs for this arena.org.bukkit.Location
Get the location where spectators will spawn.List
<org.bukkit.entity.Player> Get a list of spectators in the arena.Get the starting task for the arena.Get the start time of the arena.Get the current status of the arena.Get a team in the arena by its name.getTeam
(org.bukkit.entity.Player player) Get the team of a player.Get the team assigner used for assigning teams in an arena.getTeams()
Get the list of teams in the arena.int
Get the count of upgrade diamonds.int
Get the count of upgrade emeralds.org.bukkit.Location
Get the location where players will spawn when joining (waiting/starting).org.bukkit.World
getWorld()
Get the arena world.Get the name of the world associated with the arena.int
Get the Y-coordinate height at which players are instantly killed.void
init
(org.bukkit.World world) Initialize the arena after loading the world.boolean
Enable or disable the ender dragon from destroying blocks even when protected.boolean
Check if breaking map is allowed, otherwise only placed blocks are allowed.boolean
Check if spectating is allowed in the arena.boolean
isBlockPlaced
(org.bukkit.block.Block block) Check if the given block is placed in the arena.boolean
Check if map break is enabled.boolean
isPlayer
(org.bukkit.entity.Player player) Check if a player is currently playing in the arena.boolean
isProtected
(org.bukkit.Location location) Check if the given location is protected.boolean
isReSpawning
(UUID player) Check if a player is respawning in this arena.boolean
isReSpawning
(org.bukkit.entity.Player player) Check if a player is in the re-spawning screen/countdown.boolean
isSpectator
(UUID player) Check if a player is spectating on this arena.boolean
isSpectator
(org.bukkit.entity.Player player) Check if a player is spectating on this arena.boolean
isTeamBed
(org.bukkit.Location location) Check if there is a player bed at the specified location.void
Refresh the join signs for the arena.boolean
reJoin
(org.bukkit.entity.Player p) Rejoin an arena.void
removePlacedBlock
(org.bukkit.block.Block block) Remove the specified placed block from the arena.void
removePlayer
(org.bukkit.entity.Player p, boolean disconnect) Remove a player from the arena and execute party checks.void
removePlayer
(org.bukkit.entity.Player p, boolean disconnect, boolean skipPartyCheck) Remove a player from the arenavoid
removeSpectator
(org.bukkit.entity.Player p, boolean disconnect) Remove a spectator from the arenavoid
removeSpectator
(org.bukkit.entity.Player p, boolean disconnect, boolean skipPartyCheck) Remove a spectator from the arenavoid
restart()
Restart the arena.void
Show upgrade announcement to players.void
Show upgrade announcement to players.void
sendPreGameCommandItems
(org.bukkit.entity.Player p) Give the pre-game command items to a player.void
sendSpectatorCommandItems
(org.bukkit.entity.Player p) Give the spectator command items to a player.void
setAllowEnderDragonDestroy
(boolean allowDestory) Enable or disable the ender dragon from destroying blocks even when protected.void
setAllowMapBreak
(boolean value) Set whether map break is allowed or not.void
setAllowSpectate
(boolean allowSpectate) Set whether spectating is allowed in the arena.void
Set the arena group of the arena.void
setNextEvent
(NextEvent nextEvent) Set the next event for the arena.void
Set the game status of the arena without starting the corresponding tasks.void
setTeamAssigner
(ITeamAssigner teamAssigner) Set the team assigner used for assigning teams in an arena.void
setWorldName
(String name) Change the world name.boolean
startReSpawnSession
(org.bukkit.entity.Player player, int seconds) Put a player in a re-spawning countdown.void
This will attempt to upgrade the next event if it is the case.
-
Method Details
-
isSpectator
boolean isSpectator(org.bukkit.entity.Player player) Check if a player is spectating on this arena.- Parameters:
player
- The player to check.- Returns:
- `true` if the player is spectating, `false` otherwise.
-
isSpectator
Check if a player is spectating on this arena.- Parameters:
player
- The UUID of the player to check.- Returns:
- `true` if the player is spectating, `false` otherwise.
-
isReSpawning
Check if a player is respawning in this arena.- Parameters:
player
- The UUID of the player to check.- Returns:
- `true` if the player is respawning, `false` otherwise.
-
getArenaName
String getArenaName()Get the used world name for the arena.- Returns:
- The name of the world used by the arena.
-
init
void init(org.bukkit.World world) Initialize the arena after loading the world. This needs to be called in order to allow players to join.- Parameters:
world
- The world object associated with the arena.
-
getConfig
ConfigManager getConfig()Get the configuration manager for the arena.- Returns:
- The configuration manager.
-
isPlayer
boolean isPlayer(org.bukkit.entity.Player player) Check if a player is currently playing in the arena.- Parameters:
player
- The player to check.- Returns:
- `true` if the player is playing, `false` otherwise.
-
getSpectators
List<org.bukkit.entity.Player> getSpectators()Get a list of spectators in the arena.- Returns:
- The list of spectators.
-
getTeam
Get the team of a player. This method will only work if the player is alive.Use
getExTeam(UUID)
to get the team the player played for in the current match if the player has been eliminated.- Parameters:
player
- The player to get the team for.- Returns:
- The player's team.
-
getExTeam
Get the team the player played for in the current match. This should be used if the player has been eliminated.- Parameters:
player
- The UUID of the player.- Returns:
- The team the player played for in the current match.
-
getDisplayName
String getDisplayName()Get the arena name as a message that can be used on signs, etc. This replaces '-' and '_' with spaces in the arena name.- Returns:
- The arena name with '-' and '_' replaced by spaces.
-
setWorldName
Change the world name.- Parameters:
name
- The new world name.
-
getStatus
GameState getStatus()Get the current status of the arena.- Returns:
- The current status of the arena.
-
getPlayers
List<org.bukkit.entity.Player> getPlayers()Get a list of players currently in the arena.- Returns:
- The list of players in the arena.
-
getMaxPlayers
int getMaxPlayers()Get the maximum number of players allowed in the arena.- Returns:
- The maximum number of players allowed.
-
getGroup
String getGroup()Get the group of the arena.- Returns:
- The group of the arena.
-
getMaxInTeam
int getMaxInTeam()Get the maximum number of players allowed in a team.- Returns:
- The maximum number of players allowed in a team.
-
getRespawnSessions
ConcurrentHashMap<org.bukkit.entity.Player,Integer> getRespawnSessions()Get a map of players in the respawn screen and their remaining time. The map key is the player in the respawn screen, and the value is the remaining time.- Returns:
- The map of players in the respawn screen and their remaining time.
-
updateNextEvent
void updateNextEvent()This will attempt to upgrade the next event if it is the case. -
addPlayer
boolean addPlayer(org.bukkit.entity.Player p, boolean skipOwnerCheck) Add a player to the arena- Parameters:
p
- Player to add.skipOwnerCheck
- True if you want to skip the party checking for this player. This- Returns:
- true if was added.
-
addSpectator
boolean addSpectator(org.bukkit.entity.Player p, boolean playerBefore, org.bukkit.Location staffTeleport) Add a player as Spectator- Parameters:
p
- Player to be addedplayerBefore
- True if the player has played in this arena before and he died so now should be a spectator.
-
removePlayer
void removePlayer(org.bukkit.entity.Player p, boolean disconnect) Remove a player from the arena and execute party checks.- Parameters:
p
- Player to be removeddisconnect
- True if the player was disconnected
-
removePlayer
void removePlayer(org.bukkit.entity.Player p, boolean disconnect, boolean skipPartyCheck) Remove a player from the arena- Parameters:
p
- Player to be removeddisconnect
- True if the player was disconnectedskipPartyCheck
- (default false) True if you want to skip the party checking for this player. This will stop the player from leaving a party if he is in one. or will stop the party from being disbanded if the player is the owner.
-
removeSpectator
void removeSpectator(org.bukkit.entity.Player p, boolean disconnect) Remove a spectator from the arena- Parameters:
p
- Player to be removeddisconnect
- True if the player was disconnected
-
removeSpectator
void removeSpectator(org.bukkit.entity.Player p, boolean disconnect, boolean skipPartyCheck) Remove a spectator from the arena- Parameters:
p
- Player to be removeddisconnect
- True if the player was disconnectedskipPartyCheck
- (default false) True if you want to skip the party checking for this player. This will stop the player from leaving a party if he is in one. or will stop the party from being disbanded if the player is the owner.
-
reJoin
boolean reJoin(org.bukkit.entity.Player p) Rejoin an arena.- Parameters:
p
- The player who wants to rejoin the arena.- Returns:
- `true` if the player can rejoin the arena, `false` otherwise.
-
disable
void disable()Disable the arena. This will automatically kick/remove the players from the arena. -
restart
void restart()Restart the arena. -
getWorld
org.bukkit.World getWorld()Get the arena world.- Returns:
- The world associated with the arena.
-
getDisplayStatus
Get the display status for the arena. This returns a message that can be used on signs, etc.- Parameters:
lang
- The language used to retrieve the display status message.- Returns:
- The display status message for the arena.
-
getDisplayGroup
Get the arena display group for the given player.- Parameters:
player
- The player for which to retrieve the display group.- Returns:
- The translated display group for the player.
-
getDisplayGroup
Get the arena display group for the given language.- Parameters:
language
- The language for which to retrieve the display group.- Returns:
- The translated display group for the language.
-
getTeams
Get the list of teams in the arena.- Returns:
- The list of teams in the arena.
-
addPlacedBlock
void addPlacedBlock(org.bukkit.block.Block block) Add a placed block to the cache. This allows players to remove blocks placed by other players.- Parameters:
block
- The placed block to add to the cache.
-
getFireballCooldowns
Gets the cooldowns for fireballs in the arena.- Returns:
- The cooldowns for fireballs, mapping player UUIDs to their respective cooldown expiration timestamps.
-
removePlacedBlock
void removePlacedBlock(org.bukkit.block.Block block) Remove the specified placed block from the arena.- Parameters:
block
- The block to remove.
-
isBlockPlaced
boolean isBlockPlaced(org.bukkit.block.Block block) Check if the given block is placed in the arena.- Parameters:
block
- The block to check.- Returns:
- `true` if the block is placed in the arena, `false` otherwise.
-
getPlayerKills
int getPlayerKills(org.bukkit.entity.Player p, boolean finalKills) Get the number of kills for a player.- Parameters:
p
- The target player.finalKills
- True to get the number of final kills, false for regular kills.- Returns:
- The number of kills for the player.
-
getPlayerBedsDestroyed
int getPlayerBedsDestroyed(org.bukkit.entity.Player p) Get the number of beds destroyed by a player.- Parameters:
p
- The target player.- Returns:
- The number of beds destroyed by the player.
-
getSigns
List<org.bukkit.block.Block> getSigns()Get the join signs for this arena.- Returns:
- A list of join signs for the arena.
-
getIslandRadius
int getIslandRadius()Get the radius of the islands in the arena.- Returns:
- The island radius.
-
setGroup
Set the arena group of the arena.- Parameters:
group
- The arena group name to set.
-
setStatus
Set the game status of the arena without starting the corresponding tasks.- Parameters:
status
- The game status to set.
-
changeStatus
Change the game status of the arena and start the corresponding tasks.- Parameters:
status
- The game status to change to.
-
addSign
void addSign(org.bukkit.Location loc) Add a join sign for the arena at the specified location.- Parameters:
loc
- The location of the join sign.
-
refreshSigns
void refreshSigns()Refresh the join signs for the arena. -
addPlayerKill
void addPlayerKill(org.bukkit.entity.Player p, boolean finalKill, org.bukkit.entity.Player victim) Add a player kill to the game statistics.- Parameters:
p
- The player who made the kill.finalKill
- Whether it was a final kill.victim
- The player who was killed.
-
addPlayerBedDestroyed
void addPlayerBedDestroyed(org.bukkit.entity.Player p) Add a bed destroyed event to the temporary statistics of a player.- Parameters:
p
- The player who destroyed a bed.
-
checkWinner
void checkWinner()Check for a winner in the arena. This method should be used to manage your win conditions and trigger the arena restart if necessary. -
addPlayerDeath
void addPlayerDeath(org.bukkit.entity.Player p) Add a player death to the temporary statistics.- Parameters:
p
- The player who died.
-
setNextEvent
Set the next event for the arena.- Parameters:
nextEvent
- The next event to set.
-
getNextEvent
NextEvent getNextEvent()Get the next event for the arena.- Returns:
- The next event.
-
sendPreGameCommandItems
void sendPreGameCommandItems(org.bukkit.entity.Player p) Give the pre-game command items to a player. This will clear the player's inventory first.- Parameters:
p
- The player to give the pre-game command items to.
-
sendSpectatorCommandItems
void sendSpectatorCommandItems(org.bukkit.entity.Player p) Give the spectator command items to a player. This will clear the player's inventory first.- Parameters:
p
- The player to give the spectator command items to.
-
getTeam
Get a team in the arena by its name.- Parameters:
name
- The name of the team.- Returns:
- The team with the specified name, or null if not found.
-
getStartingTask
StartingTask getStartingTask()Get the starting task for the arena.- Returns:
- The starting task.
-
getPlayingTask
PlayingTask getPlayingTask()Get the playing task for the arena.- Returns:
- The playing task.
-
getRestartingTask
RestartingTask getRestartingTask()Get the restarting task for the arena.- Returns:
- The restarting task.
-
getAnnouncementTask
AnnouncementTask getAnnouncementTask()Get the announcement task for the arena.- Returns:
- The announcement task.
-
getOreGenerators
List<IGenerator> getOreGenerators()Get the ore generators in the arena.- Returns:
- The list of ore generators.
-
getNextEvents
Get the list of next events to come in the arena. Note: The events are not ordered.- Returns:
- The list of next events.
-
getPlayerDeaths
int getPlayerDeaths(org.bukkit.entity.Player p, boolean finalDeaths) Get the number of deaths for a specific player in the arena.- Parameters:
p
- The player.finalDeaths
- Whether to retrieve final deaths or all deaths.- Returns:
- The number of deaths for the player.
-
sendDiamondsUpgradeMessages
void sendDiamondsUpgradeMessages()Show upgrade announcement to players. Change diamondTier value first. -
sendEmeraldsUpgradeMessages
void sendEmeraldsUpgradeMessages()Show upgrade announcement to players. Change emeraldTier value first. -
getPlaced
LinkedList<org.bukkit.util.Vector> getPlaced()Get a list of placed blocks in the arena.- Returns:
- A linked list of vectors representing the locations of the placed blocks.
-
destroyData
void destroyData()This is used to destroy arena data when it restarts. -
getUpgradeDiamondsCount
int getUpgradeDiamondsCount()Get the count of upgrade diamonds.- Returns:
- The count of upgrade diamonds.
-
getUpgradeEmeraldsCount
int getUpgradeEmeraldsCount()Get the count of upgrade emeralds.- Returns:
- The count of upgrade emeralds.
-
getRegionsList
Get the list of regions for the arena.- Returns:
- The list of regions.
-
getShowTime
ConcurrentHashMap<org.bukkit.entity.Player,Integer> getShowTime()Get the show time map for armor invisibility.- Returns:
- The show time map.
-
setAllowSpectate
void setAllowSpectate(boolean allowSpectate) Set whether spectating is allowed in the arena.- Parameters:
allowSpectate
- `true` to allow spectating, `false` to disallow.
-
isAllowSpectate
boolean isAllowSpectate()Check if spectating is allowed in the arena.- Returns:
- `true` if spectating is allowed, `false` otherwise.
-
getWorldName
String getWorldName()Get the name of the world associated with the arena.- Returns:
- The name of the world.
-
getRenderDistance
int getRenderDistance()Get the player's render distance in blocks.- Returns:
- The render distance in blocks.
-
startReSpawnSession
boolean startReSpawnSession(org.bukkit.entity.Player player, int seconds) Put a player in a re-spawning countdown.- Parameters:
player
- The target player.seconds
- The countdown in seconds. Use 0 for instant re-spawn.- Returns:
- `true` if the player is successfully put in a re-spawn session, `false` otherwise.
-
isReSpawning
boolean isReSpawning(org.bukkit.entity.Player player) Check if a player is in the re-spawning screen/countdown.- Parameters:
player
- The player to check.- Returns:
- `true` if the player is in the re-spawning screen/countdown, `false` otherwise.
-
getReSpawnLocation
org.bukkit.Location getReSpawnLocation()Get the re-spawning screen location.- Returns:
- The re-spawning screen location.
-
getSpectatorLocation
org.bukkit.Location getSpectatorLocation()Get the location where spectators will spawn.- Returns:
- The spectator spawn location.
-
setAllowMapBreak
void setAllowMapBreak(boolean value) Set whether map break is allowed or not.- Parameters:
value
- `true` to allow map break, `false` otherwise.
-
isMapBreakable
boolean isMapBreakable()Check if map break is enabled.- Returns:
- `true` if map break is enabled, `false` otherwise.
-
getWaitingLocation
org.bukkit.Location getWaitingLocation()Get the location where players will spawn when joining (waiting/starting).- Returns:
- The waiting location.
-
isProtected
boolean isProtected(org.bukkit.Location location) Check if the given location is protected. This includes border checks, regions, island spawn protection, NPC protections, and generator protections.- Parameters:
location
- The location to check.- Returns:
- `true` if the location is protected, `false` otherwise.
-
abandonGame
void abandonGame(org.bukkit.entity.Player player) Triggered when a player has abandoned a game. This should remove their assist from the existing team and re-join the session. Note: This does not replace the `removePlayer(Player, boolean)` method.- Parameters:
player
- The player who has abandoned the game.
-
getYKillHeight
int getYKillHeight()Get the Y-coordinate height at which players are instantly killed. Use -1 to disable void kills.- Returns:
- The Y-coordinate height for instant kills.
-
getStartTime
Instant getStartTime()Get the start time of the arena.- Returns:
- The start time.
-
getTeamAssigner
ITeamAssigner getTeamAssigner()Get the team assigner used for assigning teams in an arena.- Returns:
- The team assigner.
-
setTeamAssigner
Set the team assigner used for assigning teams in an arena.- Parameters:
teamAssigner
- The team assigner to be set.
-
getDragonBossbars
List<me.neznamy.tab.api.bossbar.BossBar> getDragonBossbars()Get the list of dragon boss bars in the arena.- Returns:
- The list of dragon boss bars.
-
isAllowMapBreak
boolean isAllowMapBreak()Check if breaking map is allowed, otherwise only placed blocks are allowed. Some blocks like have a special protections, like blocks under shopkeepers, bed, etc.- Returns:
- true if the map break is enabled, false otherwise.
-
isTeamBed
boolean isTeamBed(org.bukkit.Location location) Check if there is a player bed at the specified location.- Parameters:
location
- The location to check for a bed.- Returns:
- true if there is a bed at the given location, false otherwise.
-
getBedsTeam
Get the team that owns the bed at the specified location.- Parameters:
location
- The location to check for a bed.- Returns:
- The team that owns the bed at the given location, or null if there is no bed or if the location is not in this arena's world.
-
isAllowEnderDragonDestroy
boolean isAllowEnderDragonDestroy()Enable or disable the ender dragon from destroying blocks even when protected.- Returns:
- true if the ender dragon can destroy blocks, false otherwise.
-
setAllowEnderDragonDestroy
void setAllowEnderDragonDestroy(boolean allowDestory) Enable or disable the ender dragon from destroying blocks even when protected.- Parameters:
allowDestory
- true if the ender dragon can destroy blocks, false otherwise.
-
getMagicMilkTime
int getMagicMilkTime()Get the time in seconds when the magic milk effect will expire.- Returns:
- The time when the magic milk effect will expire.
-