Interface Arena
- All Superinterfaces:
Metadatable
,PersistentStorage.Holder
- The status (
getStatus()
) describing what exactly the arena is doing at a given moment- The type/regeneration type (
getRegenerationType()
) the form of the arena- Various properties, such as the name, authors, teams, spawners...
Those are needed to have a working match.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an author.void
addAuthors
(Collection<String> authors) Adds multiple authors.default @Nullable AddPlayerIssue
Same asaddPlayer(Player, Team, AddPlayerCause)
, but player won't join any team automatically and passesAddPlayerCause.PLUGIN
as the reason for the player joining the arena.default @Nullable AddPlayerIssue
Same asaddPlayer(Player, Team, AddPlayerCause)
, passesAddPlayerCause.PLUGIN
as the reason for the player joining the arena.@Nullable AddPlayerIssue
addPlayer
(Player player, @Nullable Team team, AddPlayerCause cause) Tries to add the player to the arena.void
addPlayerTrapBypass
(Player player, boolean keepOnDeath) Gives a player the ability to bypass team trapsvoid
addPrizeForMatchDisabledTicket
(String ticketId) Set whether prizes (rewards in form of e.g. coins, achievements, stats ...) will be given to players during this match.addSpawner
(XYZ location, DropType type) Adds a spawner to the arenadefault @Nullable Spectator
addSpectator
(Player player) Same asaddSpectator(Player, SpectateReason)
.@Nullable Spectator
addSpectator
(Player player, SpectateReason reason) Adds a player as a spectator.void
addTeamEffect
(Team team, boolean baseOnly, PotionEffectType potionEffectType, int amplifier) Adds an effect for all the players in a certain teamvoid
addTeamEnchantment
(Team team, TeamEnchantment teamEnchantment) Adds a team enchantment to a team, and applies it to team playersvoid
applyPlayerClimate
(Player player) Applies the configured weather and time properties to the player.asRemote()
Returns theRemoteArena
variant of this arena.void
Sends this message to every player and spectatorvoid
Plays the sound to every player and spectatorvoid
Sends this message to every player and spectatorvoid
Broadcast that a custom property has been changed (e.g. the value of an arena picker).default boolean
canPlaceBlockAt
(Block block) Returns whether a player would be able to place a block at a specific location.default boolean
canPlaceBlockAt
(Block block, @Nullable Material blockMaterial) Returns whether a player would be able to place a block at a specific location.default boolean
canPlaceBlockAt
(Location loc) Returns whether a player would be able to place a block at a specific location.boolean
canPlaceBlockAt
(Location loc, @Nullable Material blockMaterial) Returns whether a player would be able to place a block at a specific location.boolean
canPlayerBypassTrap
(Player player) Whether or not a player can bypass team trapsvoid
destroyBed
(Team team) Tries to break/destroy the bed of a team.void
destroyBedBlocks
(Team team) Tries to break/destroy the bed blocks of a team, but not change the internal state.@Nullable ArenaBedBreakEvent
Will destroy the bed as if a player actually broke it ingame.default @Nullable ArenaBedBreakEvent
destroyBedNaturally
(Team team, @Nullable Player player) Will destroy the bed as if a player actually broke it ingame.boolean
Forcefully stop the match right now.boolean
exists()
Returns whether this arena is still existing.formatItemStack
(ItemStack itemStack, @Nullable Player player, Team team) Returns the same ItemStack but possibly dyed or enchanted depending on team upgrades, and previous player purchases.Returns a List of all teams that still have a bed.getAliveTeams
(Player... ignorePlayers) Returns a List of all teams that have at least one player.double
This method calculates an approximate duration of the regeneration of an arena.String[]
Returns the authors of the arena.@Nullable Instant
getBedDestructionTime
(Team team) Get the time when the bed of a team has been destroyed in ms.@Nullable HologramEntity
getBedHologram
(Team team) Gets the hologram that is optionally being spawned above the team's bed.@Nullable XYZD
getBedLocation
(Team team) Returns the location the team's bed location.Block[]
getBedParts
(Team team) Returns the blocks of all the team's bed parts.void
getBedPartsAsync
(Team team, Consumer<Block[]> callback) Returns the blocks of all the team's bed parts.int
getBuyGroupLevel
(Player player, BuyGroup group) Returns the current buy-group level of the player.@Nullable Arena
Gets the arena from which this arena has been cloned from.Arena[]
Gets all arenas that were cloned using this arena (basically the child arenas).Returns the custom name of the arena.default Set
<ArenaIssuesCheckEvent.Issue> Returns all the issues that were detected by this plugin (and not manually added by others) that prevent the arena from running.getDefaultIssues
(@Nullable CommandSender sender) Returns all the issues that were detected by this plugin (and not manually added by others) that prevent the arena from running.Returns all authors in a string split up by a comma.getDisplayedAuthors
(@Nullable CommandSender sender) Returns all authors in a string split up by a comma.Returns the non-unique name of the arena for displaying to playersReturns every team that has been enabled for this arena.Returns the spectator data of every player who's currently spectating this arena@Nullable World
Returns the world in which the arena is located at.Returns the name of the world in which the game is located at.getIcon()
Gets the icon of the arena.int
Returns how much time is left (in seconds) until an active match is ending.Returns all the issues that prevent the arena from running.getIssues
(@Nullable CommandSender sender) Returns all the issues that prevent the arena from running.getItemsGivenOnSpawn
(Player player, Team team, boolean firstSpawn, boolean includeKeepOnDeath) Returns all the ItemStacks that will be given to a player when they spawn with all dyes already applied, and enchantments added.@Nullable Location
The lobby location which can be set with /bw arena setlobbydouble
Returns how much time is left until the game starts (ArenaStatus.LOBBY
) or until all players get kicked (ArenaStatus.END_LOBBY
).int
Calculates [teams amount] x [players per team] when using a normal arena.@Nullable XYZ
An arena of the typeRegenerationType.REGION
has two corners.int
Returns the minimum amount of players that are needed to start match.@Nullable XYZ
An arena of the typeRegenerationType.REGION
has two corners.getName()
Returns the unique name of the arena.<T> T
Returns the Arena instance that's being used internally.@Nullable Arena
Returns the voting arena in which this arena is in the pool of.Gets a helper class for storing persistent information for exactly this arena instance.@Nullable Inventory
getPlayerPrivateInventory
(Player player) Obtain a players private chest inventory using this method.Returns all players (except spectators) who are inside the lobby.getPlayersInTeam
(@Nullable Team team) Returns a List of all players that are in a specific team.int
Returns the amount of players that can be in a team.@Nullable Team
getPlayerTeam
(Player player) Returns the team of a player.Get a list of ticket ids of whatever reason the prize for match has been disabled.Returns all memories/infos of all players who were playing in the game but left.@Nullable QuitPlayerMemory
getQuitPlayerMemory
(UUID playerUUID) Returns all memory/infos of a player who has left a running match.Returns the regeneration type aka the form/variant of the arena.@Nullable Instant
Returns the time when the arena changed the last time its state toArenaStatus.RUNNING
.@Nullable Instant
Returns the time when the arena has ended (forceful state changes don't count).@Nullable Duration
Get the time since the current match is running or how long the last has match.Returns a collection of all added spawnersSpawner[]
getSpawnersAtLocation
(IntXYZ location) Returns all spawners that are located at that block/locationSpawner[]
getSpawnersAtLocation
(XYZ location) Returns all spawners that are located at that block/locationSpawner[]
getSpawnersAtLocation
(Location location) Returns all spawners that are located at that block/location@Nullable Spectator
getSpectateData
(Player player) Looks and returns the spectator data of the player.Returns every player who's currently spectating this arena.@Nullable XYZYP
Returns the spawnpoint of a spectator.Returns the current state of the arenagetTeamBaseOnlyEffects
(Team team) Returns effects applied to a team around their base@Nullable Team
getTeamByBaseLocation
(XYZ xyz) Tries to fetch the team of a location that's inside a base.@Nullable Team
Tries to fetch the team of a location that's inside a base.@Nullable Team
getTeamByBedBlock
(IntXYZ loc) Returns the team that owns the bed part at the given location.@Nullable Team
getTeamByBedBlock
(Block block) Returns the team that owns the bed part at the given location.getTeamEnchantments
(Team team) Returns all team enchantments applied to a teamgetTeamPermanentEffects
(Team team) Returns all effects applied to a team everywhere@Nullable Inventory
getTeamPrivateInventory
(Team team) Obtain a teams private inventory using this method.@Nullable XYZYP
getTeamSpawn
(Team team) Gets the spawn point of a team.Returns a List of all teams that have at least one player.getTeamsWithPlayers
(Player... ignorePlayers) Returns a List of all teams that have at least one player.@Nullable UpgradeState
getUpgradeState
(Team team) Returns the UpgradeState of a specified team@Nullable ArenaVotingHandler
Returns the voting handler of this arena.default boolean
Returns whether a location for the lobby has been set.boolean
isBedDestroyed
(Team team) Returns whether the bed of a team has been destroyed.boolean
isBlockPlayerPlaced
(Block block) There are configurations which limit the block breaking to blocks that have been placed by players.boolean
isCloned()
Returns whether this arena has been cloned from an other arena.boolean
Returns whether this arena has a custom name enabled that'll be displayed (getDisplayName()
) in favor of the actual name (getName()
).boolean
Returns whether or not currently the ingame timer is countding downboolean
Checks whether the given location is inside the arena.boolean
Checks whether the given location is inside the arena.boolean
Checks whether the given location is inside the arena.boolean
isPlayerTrapBypassKeepOnDeath
(Player player) Whether or not the players ability to bypass teams traps will remain if they die.boolean
Get whether prizes (rewards in form of e.g. coins) will be given to players during this match.boolean
The saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async.boolean
Gets whether the player's time shall be reset to default after one leaves.boolean
Gets whether the player's weather shall be reset to default after one leaves.boolean
isTeamEnabled
(Team team) Returns whether or not a team is enabled.default int
Does the same askickAllPlayers(KickReason)
, but usesKickReason.PLUGIN
as the reason.default int
kickAllPlayers
(KickReason reason) Kicks every player who's currently inside the arena.default int
Does the same askickAllSpectators(KickSpectatorReason)
, but usesKickSpectatorReason.PLUGIN
as the reason.default int
kickAllSpectators
(KickSpectatorReason reason) Kicks every spectator of this arenadefault boolean
kickPlayer
(Player player) Does the same askickPlayer(Player, KickReason)
, but passesKickReason.PLUGIN
as the reason.boolean
kickPlayer
(Player player, KickReason reason) Kicks the player from the arena.boolean
moveToTeamDuringLobby
(Player player, Team team) Simulates as if the player would manually want to change the team.void
Tries to place the bed of a team.void
placeBedBlocks
(Team team) Tries to place the bed blocks of a team, but not change the internal state.@Nullable RejoinPlayerIssue
rejoinPlayer
(Player player) Tries to make the player rejoin an already active game.@Nullable RejoinPlayerIssue
rejoinPlayer
(Player player, @Nullable QuitPlayerMemory memory) Tries to make the player rejoin an already active game using some rejoin info contained in the memory.boolean
remove()
Removes the arena and kicks all playing players + spectators.int
Removes all existing authors.boolean
removeAuthor
(String author) Removes an author.void
removePlayerTrapBypass
(Player player) Removes a player's ability to bypass team trapsboolean
removePrizeForMatchDisabledTicket
(String ticketId) Remove a ticket id from the list of reasons to disable prizes (rewards in form of e.g. coins, achievements, stats ...).boolean
removeTeamEffect
(Team team, PotionEffectType potionEffectType) Removes an effect from a teamboolean
removeTeamEnchantment
(Team team, TeamEnchantment teamEnchantment) Removes a team enchantment from a team, and applies it to team playersdefault void
The saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async.void
runRegenerationBlocksSavingProcess
(@Nullable Consumer<Boolean> finishCallback) The saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async.void
Save the arenas current state.void
saveNow()
Save the arenas current state.boolean
setBedLocation
(Team team, @Nullable XYZD loc) Sets the bed location of a team.void
setBlockPlayerPlaced
(Block block, boolean newState) There are configurations which limit the block breaking to blocks that have been placed by players.void
setBuyGroupLevel
(Player player, BuyGroup group, int level) Modify the buy-group level of the player.void
setCustomName
(String customName) Set the custom name of the arena.void
setCustomNameEnabled
(boolean customNameEnabled) Set whether this arena has a custom name enabled that'll be displayed (getDisplayName()
) in favor of the actual name (getName()
).void
setGameWorld
(@Nullable World world) Sets the world in which the game is located at.void
setGameWorldName
(@Nullable String name) Set the name of the world in which the game is located at.void
Set the new icon for the arena.void
setIngameTimeRemaining
(int timeInSeconds) Set the time (in seconds) until an active match is ending.void
setLobbyLocation
(@Nullable Location location) Set the location for the lobby to which the players will be teleported at when they join the arena.default boolean
setLobbyTimeRemaining
(double value) Set the new time until the lobby showdown is being executed.boolean
setLobbyTimeRemaining
(double value, boolean instant) Set the new time until the lobby showdown is being executed.void
setMinPlayers
(int minPlayers) Set the minimum amount of players that are needed to start a match.boolean
Changes the name of the arena.void
setPlayersPerTeam
(int playersPerTeam) Set the amount of players that can be in a team.void
setPlayerTeam
(Player player, @Nullable Team team) Change the team of a player.void
This method allows you to change the form of the arenavoid
setRegionCorners
(XYZ pos1, XYZ pos2) An arena of the typeRegenerationType.REGION
has two corners.void
setResetPlayerTimeOnQuit
(boolean newValue) Define whether the player's time should be reset to default after one leaves.void
setResetPlayerWeatherOnQuit
(boolean newValue) Define whether the player's weather should be reset to default after one leaves.void
setSpectatorSpawn
(@Nullable XYZYP location) Set the spawnpoint for spectators.void
setStatus
(ArenaStatus status) Not only changes the status, but also does operations depending on the status.boolean
setTeamEnabled
(Team team, boolean enabled) Enables or disables a team in this arena.boolean
setTeamSpawn
(Team team, @Nullable XYZYP loc) Set the spawn point of a team.void
Usually the plugin prevents players from getting teleported and automatically kicks them from the game if they try to.default void
teleportHere
(Player player) Teleports the player inside this arena.void
teleportHere
(Player player, boolean sendMessage) Teleports the player inside this arena.void
Removes any set corners in the arena.void
Forcefully update the scoreboard for any player and spectatorMethods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
-
Method Details
-
getName
String getName()Returns the unique name of the arena.- Returns:
- Returns the actual name of the arena
-
setName
Changes the name of the arena.Operation can fail when there's already an arena with the name or when the name is invalid. Use
GameAPI.isArenaNameValid(String)
to check if the name is valid- Parameters:
name
- The new name- Returns:
- Returns whether it was successful or not
-
getDisplayName
String getDisplayName()Returns the non-unique name of the arena for displaying to playersUses the custom name if one is configured, otherwise uses
getName()
- Returns:
- The name of the arena used in displays
-
isCustomNameEnabled
boolean isCustomNameEnabled()Returns whether this arena has a custom name enabled that'll be displayed (getDisplayName()
) in favor of the actual name (getName()
).- Returns:
true
when the feature is being used with this arena
-
setCustomNameEnabled
void setCustomNameEnabled(boolean customNameEnabled) Set whether this arena has a custom name enabled that'll be displayed (getDisplayName()
) in favor of the actual name (getName()
).- Parameters:
customNameEnabled
-true
causes this feature to get enabled for this arena
-
getCustomName
String getCustomName()Returns the custom name of the arena.Keep this mind that this method always returns a non-null value, meaning that internally there's always one, even if
isCustomNameEnabled()
returns false.- Returns:
- The custom name.
-
setCustomName
Set the custom name of the arena.You might want to use
setCustomNameEnabled(boolean)
as well.- Parameters:
customName
- The new custom name.
-
getStatus
ArenaStatus getStatus()Returns the current state of the arena- Returns:
- The current state of the arena
-
setStatus
Not only changes the status, but also does operations depending on the status.Examples:
- Enables regeneration process withArenaStatus.RESETTING
- Starting the match withArenaStatus.RUNNING
It may NOT support this for all operations- Parameters:
status
- The new status- Throws:
IllegalStateException
- When trying to set it toArenaStatus.RUNNING
and certain conditions (not in lobby, no players) aren't met
-
getRegenerationType
RegenerationType getRegenerationType()Returns the regeneration type aka the form/variant of the arena.- Returns:
- The regeneration type of the arena
-
setRegenerationType
This method allows you to change the form of the arena- Parameters:
type
- The new regeneration type
-
getApproxRegenerationTime
double getApproxRegenerationTime()This method calculates an approximate duration of the regeneration of an arena.The returned value might be far away from the real time. It might return
Double.NaN
when it's not possible to calculate it at the given moment.- Returns:
- The estimated time in seconds of how long it'll take to regenerate the arena
-
getEnabledTeams
Returns every team that has been enabled for this arena.- Returns:
- All added teams
-
setTeamEnabled
Enables or disables a team in this arena.Disabling an arena can cause some data to disappear, such as the location of their beds.
It's not possible to enable or disable an arena whilegetStatus()
returns anything other thanArenaStatus.STOPPED
.- Parameters:
team
- The team that shall be enabled or disabledenabled
- The new state- Returns:
- If a change was done. Might return false when the new state is equal to the old state or some conditions aren't given
-
isTeamEnabled
Returns whether or not a team is enabled.- Parameters:
team
- The team we want to check- Returns:
true
if it's enabled
-
getBedLocation
Returns the location the team's bed location.Might return null if it hasn't been set yet or when the team hasn't been added.
The world that's being used is
getGameWorld()
.- Parameters:
team
- The team that owns the bed- Returns:
- The location of the bed. Might return
null
- See Also:
-
getTeamByBedBlock
Returns the team that owns the bed part at the given location.- Parameters:
block
- The block of a bed part- Returns:
- The team that owns the bed part. May be
null
if no team owns a bed at the given location
-
getTeamByBedBlock
Returns the team that owns the bed part at the given location.- Parameters:
loc
- The location of a bed part- Returns:
- The team that owns the bed part. May be
null
if no team owns a bed at the given location
-
getBedParts
Returns the blocks of all the team's bed parts.A bed usually persists of two parts: the head and the body. The actually structure may vary depending on the bed material that is being used. This method returns the locations of all bed parts.
Length might be 0 if no bed has been added.
- Parameters:
team
- The team that owns the bed- Returns:
- All the locations/blocks of the bed parts
- See Also:
-
getBedPartsAsync
Returns the blocks of all the team's bed parts.See
getBedParts(Team)
The difference is that this method loads the chunks async, while the other might freeze the main thread until they did. For peformance reasons, you should use this async one instead - if possible.- Parameters:
team
- The team that owns the bedcallback
- The callback that will be called when the blocks have been loaded- See Also:
-
setBedLocation
Sets the bed location of a team.This won't automatically replace the bed when the game is running.
The world that's being used is
getGameWorld()
.The operation might fail when the given team hasn't been added to the arena.
- Parameters:
team
- The team that owns the bedloc
- The location of the bed,null
if it shall be removed in the storage- Returns:
true
if the operation was successful
-
isBedDestroyed
Returns whether the bed of a team has been destroyed.This only returns the internal state. The bed blocks might still be there.
- Parameters:
team
- The team that owns the bed- Returns:
- If it has been destroyed or not
-
getBedDestructionTime
Get the time when the bed of a team has been destroyed in ms.- Parameters:
team
- The team that owns the bed- Returns:
- The time in ms of when the bed has been destroyed. May be
null
if it hasn't been destroyed yet
-
getBedHologram
Gets the hologram that is optionally being spawned above the team's bed.Hologram may be used to e.g. display the state of the bed. May be
null
if e.g. the round hasn't started yet or it has been disabled.- Parameters:
team
- The team of the bed- Returns:
- The hologram above the bed. May be
null
-
getTeamSpawn
Gets the spawn point of a team. Actual spawn point might vary as the location might be blocked by a block.It's possible that this method returns
null
when the team hasn't been added yet or the spawn point hasn't been set.The world that's being used is
getGameWorld()
.- Parameters:
team
- The team we want to obtain it from- Returns:
- The location of their spawn. Might return
null
-
setTeamSpawn
Set the spawn point of a team.The world that's being used is
getGameWorld()
.The operation might fail when the given team hasn't been added to the arena.
- Parameters:
team
- The team that will teleport at that locationloc
- The new location, usenull
to remove it from the storage- Returns:
true
when the operation was successful
-
getUpgradeState
Returns the UpgradeState of a specified team- Parameters:
team
- The team we want to get the UpgradeState from- Returns:
- The UpgradeState for the team. May be
null
if the arena is not running
-
getTeamBaseOnlyEffects
Returns effects applied to a team around their base- Parameters:
team
- The team that we are getting the effects from- Returns:
- A list of potion effects that are being applied
-
getTeamPermanentEffects
Returns all effects applied to a team everywhere- Parameters:
team
- The team that we are getting the effects from- Returns:
- A list of potion effects that are being applied
-
addTeamEffect
Adds an effect for all the players in a certain team- Parameters:
team
- The team the effect should be added tobaseOnly
- Whether the effect is only active inside a teams basepotionEffectType
- the effect that should be givenamplifier
- How strong the effect is
-
removeTeamEffect
Removes an effect from a team- Parameters:
team
- The team we will try and remove the effect frompotionEffectType
- The effect type that should be removed- Returns:
true
when one equal instance has been found and removed
-
getTeamEnchantments
Returns all team enchantments applied to a team- Parameters:
team
- The team we want to obtain it from- Returns:
- A list of team enchantments the team owns
-
addTeamEnchantment
Adds a team enchantment to a team, and applies it to team players- Parameters:
team
- The team that the new enchantment is forteamEnchantment
- The new team enchantment being applied
-
removeTeamEnchantment
Removes a team enchantment from a team, and applies it to team players- Parameters:
team
- The team that we are removing the enchantment fromteamEnchantment
- The team enchantment that is being removed- Returns:
true
when one equal instance has been found and removed
-
placeBed
Tries to place the bed of a team.This method also modifies the internal state of the bed (basically revives the team). This operation is being done silently, meaning the players won't be notified about this.
Bed blocks are being placed async, if the Spigot version supports it. This means that it is theoretically not possible to immediately check the block type immediately after calling this method.
- Parameters:
team
- The team that owns the bed- See Also:
-
destroyBed
Tries to break/destroy the bed of a team.This method also modifies the internal state of the bed (basically causes the team to not being able to respawn). This operation is being done silently, meaning the players won't be notified about this.
Bed blocks are being destroyed async, if the Spigot version supports it. This means that it is theoretically not possible to immediately check the block type immediately after calling this method.
- Parameters:
team
- The team that owns the bed- See Also:
-
placeBedBlocks
Tries to place the bed blocks of a team, but not change the internal state.Bed blocks are being placed async, if the Spigot version supports it. This means that it is theoretically not possible to immediately check the block type immediately after calling this method.
- Parameters:
team
- The team from whom the bed blocks shall be destroyed- See Also:
-
destroyBedBlocks
Tries to break/destroy the bed blocks of a team, but not change the internal state.Bed blocks are being destroyed async, if the Spigot version supports it. This means that it is theoretically not possible to immediately check the block type immediately after calling this method.
- Parameters:
team
- The team from whom the bed blocks shall be destroyed- See Also:
-
destroyBedNaturally
@Nullable default @Nullable ArenaBedBreakEvent destroyBedNaturally(Team team, @Nullable @Nullable Player player) Will destroy the bed as if a player actually broke it ingame.- Parameters:
team
- The team that owns the bedplayer
- The player who broke it. May benull
if its unknown- Returns:
- The event containing the result. May be
null
if the bed was already broken, or if the bed hasn't been placed yet - See Also:
-
destroyBedNaturally
Will destroy the bed as if a player actually broke it ingame.- Parameters:
info
- An info object containing information about the bed destruction- Returns:
- The event containing the result. May be
null
if the bed was already broken, or if the bed hasn't been placed yet
-
getAuthors
String[] getAuthors()Returns the authors of the arena.- Returns:
- The authors or creators of the arena
-
getDisplayedAuthors
Returns all authors in a string split up by a comma.E.g. it might return: "Notch, Marcel, Obama"
Returns "nobody" in the language of the sender if there are none- Parameters:
sender
- Returns in the language of this sender- Returns:
- The authors of the arena represented in a string
-
getDisplayedAuthors
String getDisplayedAuthors()Returns all authors in a string split up by a comma.E.g. it might return: "Notch, Marcel, Obama"
Returns "nobody" in the configured default language if there are none- Returns:
- The authors of the arena represented in a string
-
addAuthor
Adds an author.- Parameters:
author
- The author that shall be added
-
addAuthors
Adds multiple authors.- Parameters:
authors
- The authors that shall be added
-
removeAuthor
Removes an author.- Parameters:
author
- The author that shall be removed- Returns:
false
if there's no author with that name
-
removeAllAuthors
int removeAllAuthors()Removes all existing authors.- Returns:
- The amount of authors that have been removed
-
getMaxPlayers
int getMaxPlayers()Calculates [teams amount] x [players per team] when using a normal arena.It'll take the configured one when using a voting arena
- Returns:
- The maximum amount of players who can join at the same time
-
getMinPlayers
int getMinPlayers()Returns the minimum amount of players that are needed to start match.While it's not logical to have less than two, it's still legal to have any number (even one that is a minus number).
- Returns:
- The minimum amount of players needed to start a game
-
setMinPlayers
void setMinPlayers(int minPlayers) Set the minimum amount of players that are needed to start a match.While it's not logical to have less than two, it's still legal to have any number (even one that is a minus number).
- Parameters:
minPlayers
- The new minimum amount of players needed to start a game
-
getPlayersPerTeam
int getPlayersPerTeam()Returns the amount of players that can be in a team.When the arena is
RegenerationType.VOTING
then it'll return the max amount of players in the arena- Returns:
- The configured amount of players that can be in a team
-
setPlayersPerTeam
void setPlayersPerTeam(int playersPerTeam) Set the amount of players that can be in a team.When the arena is
RegenerationType.VOTING
, then it'll set the max amount of players in the arena- Parameters:
playersPerTeam
- The new configured amount of players that can be in a team
-
getGameWorld
Returns the world in which the arena is located at.- Returns:
- Might return null if the world doesn't exist
-
getGameWorldName
String getGameWorldName()Returns the name of the world in which the game is located at.- Returns:
- The configured world name in which the arena is located at
-
setGameWorldName
Set the name of the world in which the game is located at. Usenull
to reset it back to default (to remove it).- Parameters:
name
- The new game world.null
to reset it back to default
-
getMinRegionCorner
An arena of the typeRegenerationType.REGION
has two corners. This method returns the point with the lowest (Math.min(int, int)
number.It returns
null
if no points have been set or when the type is notRegenerationType.REGION
.- Returns:
- The lower corner of the cubic arena. Possibly
null
-
getMaxRegionCorner
An arena of the typeRegenerationType.REGION
has two corners. This method returns the point with the greatest (Math.max(int, int)
number.It returns
null
if no points have been set or when the type is notRegenerationType.REGION
.- Returns:
- The greater corner of the cubic arena. Possibly
null
-
setRegionCorners
An arena of the typeRegenerationType.REGION
has two corners. This method sets them.Important:
This does not automatically save the blocks of the arena. You likely want to runrunRegenerationBlocksSavingProcess(Consumer)
afterwards.You may not pass
null
as an argument. UseunsetRegionCorners()
if you want to remove them.- Parameters:
pos1
- The points of the first cornerpos2
- The points of the second corner
-
unsetRegionCorners
void unsetRegionCorners()Removes any set corners in the arena.Keep in mind that the arena gets unplayable by this.
-
setGameWorld
Sets the world in which the game is located at.Important:
This does not automatically save the blocks of the arena. You likely want to runrunRegenerationBlocksSavingProcess(Consumer)
afterwards.- Parameters:
world
- The new world, possiblynull
to unset it
-
getLobbyLocation
The lobby location which can be set with /bw arena setlobby- Returns:
- Might return null when no lobby has been set
-
getPlayersInTeam
Returns a List of all players that are in a specific team.You may pass
null
to look for players that haven't picked a team (works only during lobby).- Parameters:
team
- The team in which the players are.null
to find players who haven't picked a team- Returns:
- All players that are inside the given team
-
getAliveTeams
Returns a List of all teams that still have a bed.Note this will not return teams that have no players but are still alive because of solo reconnect. If you want to get teams that currently have players online, use
getTeamsWithPlayers()
.- Returns:
- All currently involved teams in the match
-
getAliveTeams
Returns a List of all teams that have at least one player.Use
ignorePlayers
to ignore these players in the result. Meaning it'll return all teams minusignorePlayers
that have at least one player. Note this will not return teams that have no players but are still alive because of solo reconnect. If you want to get teams that currently have players online, usegetTeamsWithPlayers(Player...)
.- Parameters:
ignorePlayers
- Will ignore these teams in the result and act as if they weren't ingame- Returns:
- All currently involved teams in the match
-
getTeamsWithPlayers
Returns a List of all teams that have at least one player.Note this will not return teams that have at least one player, however it it possible teams are still alive because of solo reconnect. If you want to get all teams that still have a bed, use
getAliveTeams()
.- Returns:
- All currently involved teams in the match
-
getTeamsWithPlayers
Returns a List of all teams that have at least one player.Use
ignorePlayers
to ignore these players in the result. Meaning it'll return all teams minusignorePlayers
that have at least one player. Note this will not return teams that have at least one player, however it it possible teams are still alive because of solo reconnect. If you want to get all teams that still have a bed, usegetAliveTeams(Player...)
.- Parameters:
ignorePlayers
- Will ignore these teams in the result and act as if they weren't ingame- Returns:
- All currently involved teams in the match
-
setLobbyLocation
Set the location for the lobby to which the players will be teleported at when they join the arena.- Parameters:
location
- The new location where the lobby is located at
-
hasLobbyLocation
default boolean hasLobbyLocation()Returns whether a location for the lobby has been set.- Returns:
- Whether a lobby location has been set yet
-
getIcon
ItemStack getIcon()Gets the icon of the arena.- Returns:
- The icon that's being used in GUIs
-
setIcon
Set the new icon for the arena.- Parameters:
icon
- The new icon that'll be used in GUIs
-
getSpawners
Collection<Spawner> getSpawners()Returns a collection of all added spawners- Returns:
- All added spawners
-
addSpawner
Adds a spawner to the arena- Parameters:
location
- The location of the spawnertype
- Info about what it shall drop- Returns:
- The spawner instance with information about it
-
getSpawnersAtLocation
Returns all spawners that are located at that block/location- Parameters:
location
- The location at which they are located at- Returns:
- All spawners at that location
-
getSpawnersAtLocation
Returns all spawners that are located at that block/location- Parameters:
location
- The location at which they are located at- Returns:
- All spawners at that location
-
getSpawnersAtLocation
Returns all spawners that are located at that block/location- Parameters:
location
- The location at which they are located at- Returns:
- All spawners at that location
-
addPlayer
Same asaddPlayer(Player, Team, AddPlayerCause)
, but player won't join any team automatically and passesAddPlayerCause.PLUGIN
as the reason for the player joining the arena.- Parameters:
player
- The player who shall enter the arena- Returns:
- Returns if it was successful, and if not what caused it
-
addPlayer
Same asaddPlayer(Player, Team, AddPlayerCause)
, passesAddPlayerCause.PLUGIN
as the reason for the player joining the arena.- Parameters:
player
- The player who shall enter the arenateam
- The team it shall automatically enter. If null is given then he won't join any team- Returns:
- Returns if it was successful, and if not what caused it
-
addPlayer
@Nullable @Nullable AddPlayerIssue addPlayer(Player player, @Nullable @Nullable Team team, AddPlayerCause cause) Tries to add the player to the arena.Doesn't send a message in the chat and only works while
getStatus()
returnsArenaStatus.LOBBY
,- Parameters:
player
- The player who shall enter the arenateam
- The team it shall automatically enter. If null is given then he won't join any teamcause
- What has made the player to join the arena. Preferably you want to useAddPlayerCause.PLUGIN
- Returns:
- Returns if it was successful, and if not what caused it
- Throws:
IllegalStateException
- When the state of the arena isn'tArenaStatus.LOBBY
or when the player isn't online
-
rejoinPlayer
Tries to make the player rejoin an already active game.Keep in mind that the player has to be an active player on the match before and that the state is
ArenaStatus.RUNNING
.- Parameters:
player
- The player who shall be readded to the game- Returns:
- The issue that prevents him from rejoining.
null
when there wasn't any
-
rejoinPlayer
@Nullable @Nullable RejoinPlayerIssue rejoinPlayer(Player player, @Nullable @Nullable QuitPlayerMemory memory) Tries to make the player rejoin an already active game using some rejoin info contained in the memory.* Keep in mind that the player has to be an active player on the match before (doesn't have to be when
memory
is not null) and that the state isArenaStatus.RUNNING
. *- Parameters:
player
- The player who shall be readded to the gamememory
- The info stored before he left the match. May be a custom instance. Whennull
, then it tries to obtain its internal stored info- Returns:
- The issue that prevents him from rejoining.
null
when there wasn't any
-
kickPlayer
Does the same askickPlayer(Player, KickReason)
, but passesKickReason.PLUGIN
as the reason.- Parameters:
player
- The player who shall get kicked- Returns:
- Returns
false
if the player isn't playing inside the arena, otherwisetrue
-
kickPlayer
Kicks the player from the arena. Won't kick spectators.- Parameters:
player
- The player who shall get kickedreason
- Reason why he got kicked- Returns:
- Returns
false
if the player isn't playing inside the arena, otherwisetrue
-
kickAllPlayers
default int kickAllPlayers()Does the same askickAllPlayers(KickReason)
, but usesKickReason.PLUGIN
as the reason.- Returns:
- The amount of players that have been kicked
-
kickAllPlayers
Kicks every player who's currently inside the arena.Spectators won't get kicked by this method.
- Parameters:
reason
- Reason why they got kicked- Returns:
- The amount of players that have been kicked
-
getPlayerTeam
Returns the team of a player. Can returnnull
when the player isn't actually inside the arena or when he hasn't been added to a team (only possible during lobby phase).- Parameters:
player
- The player we want to check- Returns:
- The team of the player, might be
null
-
setPlayerTeam
Change the team of a player.It's okay to pass
null
as the team if you want to remove him from any, but this only works during the lobby phase.Note that nothing happen if the team reached the
getPlayersPerTeam()
amount.- Parameters:
player
- The player whose team we want to changeteam
- His new team- Throws:
IllegalStateException
- When passingnull
as the team outside the lobby phase
-
moveToTeamDuringLobby
Simulates as if the player would manually want to change the team. Sends messages etc. if it was successful or something went wrong.- Parameters:
player
- The player whos team we want to changeteam
- His new team- Returns:
true
if his team changed,false
if not
-
getPlayers
Collection<Player> getPlayers()Returns all players (except spectators) who are inside the lobby.- Returns:
- All players who are currently inside the arena. Spectators are not included
-
getQuitPlayerMemories
Collection<QuitPlayerMemory> getQuitPlayerMemories()Returns all memories/infos of all players who were playing in the game but left.Is empty when the game is not running anymore and doesn't contain instances of players who rejoined.
- Returns:
- All memories of players who left a running match
-
getQuitPlayerMemory
Returns all memory/infos of a player who has left a running match.- Parameters:
playerUUID
- The id of the player- Returns:
- The memory of the player.
null
when there isn't any
-
addSpectator
Same asaddSpectator(Player, SpectateReason)
.Uses
SpectateReason.PLUGIN
as the reason- Parameters:
player
- The player who shall spectate the arena- Returns:
- An instance that contains spectating informations about the player. Null if failed because he's already spectating or something
-
addSpectator
Adds a player as a spectator.Should only be done when the arena is running, otherwise problems might occur.
- Parameters:
player
- The player who shall spectate the arenareason
- What caused the player to be a spectator- Returns:
- An instance that contains spectating informations about the player. Null if failed because he's already spectating or something
-
getSpectateData
Looks and returns the spectator data of the player.Also checks if the arena is equivalent to this one and returns null if it's not.
- Parameters:
player
- The player it should look up from- Returns:
- The spectate data from the player. Null if the player isn't spectating
-
getSpectators
Collection<Player> getSpectators()Returns every player who's currently spectating this arena.- Returns:
- All players who are currently spectating the arena
-
getEverySpectatorData
Collection<Spectator> getEverySpectatorData()Returns the spectator data of every player who's currently spectating this arena- Returns:
- The spectate data of all players who are spectating
-
kickAllSpectators
default int kickAllSpectators()Does the same askickAllSpectators(KickSpectatorReason)
, but usesKickSpectatorReason.PLUGIN
as the reason.- Returns:
- The amount of players that have been kicked
-
kickAllSpectators
Kicks every spectator of this arena- Parameters:
reason
- Reason why they got kicked- Returns:
- The amount of players that have been kicked
-
broadcast
Sends this message to every player and spectator- Parameters:
message
- The message that shall get sent
-
broadcast
Sends this message to every player and spectator- Parameters:
message
- The message that shall get sent
-
broadcast
Plays the sound to every player and spectator- Parameters:
sound
- The sound that shall get played
-
isInside
Checks whether the given location is inside the arena.Always returns false for non-normal arenas (
RegenerationType.isNormal()
)- Parameters:
location
- The location we want to check- Returns:
- If the location is inside the arena
-
isInside
Checks whether the given location is inside the arena.Always returns false for non-normal arenas (
RegenerationType.isNormal()
). Keep in mind that it'll always return true forRegenerationType.WORLD
. You might want to useisInside(Location)
for a more precise response.- Parameters:
location
- The location we want to check- Returns:
- If the location is inside the arena
-
isInside
Checks whether the given location is inside the arena.Always returns false for non-normal arenas (
RegenerationType.isNormal()
). Keep in mind that it'll always return true forRegenerationType.WORLD
. You might want to useisInside(Location)
for a more precise response.- Parameters:
location
- The location we want to check- Returns:
- If the location is inside the arena
-
getRoundStartTime
Returns the time when the arena changed the last time its state toArenaStatus.RUNNING
.May be
null
if no match has been played on this arena since server start.- Returns:
- The time when the last match has started. May be
null
-
getRoundStopTime
Returns the time when the arena has ended (forceful state changes don't count).May be
null
if the arena hasn't ended yet or it got into theArenaStatus.LOBBY
state.- Returns:
- The time when the last match has ended. May be
null
-
getRunningTime
Get the time since the current match is running or how long the last has match.May be
null
if no match has started on this arena since server start.- Returns:
- The time the arena is already running. May be
null
-
updateScoreboard
void updateScoreboard()Forcefully update the scoreboard for any player and spectator -
remove
boolean remove()Removes the arena and kicks all playing players + spectators.Might fail when the arena has already been removed or a plugin cancells the operation via the
ArenaDeleteEvent
.- Returns:
true
when the operation was successful
-
getLobbyTimeRemaining
double getLobbyTimeRemaining()Returns how much time is left until the game starts (ArenaStatus.LOBBY
) or until all players get kicked (ArenaStatus.END_LOBBY
). Might return -1 when the status isn'tArenaStatus.isLobby()
or when the timer isn't running (e.g. not enough players in the lobby).- Returns:
- The time remaining for the lobby showdown.
-1
if the requirements aren't met.
-
setLobbyTimeRemaining
boolean setLobbyTimeRemaining(double value, boolean instant) Set the new time until the lobby showdown is being executed.Might fail when the state isn't
ArenaStatus.LOBBY
.- Parameters:
value
- The new time until the lobby showdown is being executedinstant
- For the expbar animation. Iffalse
it'll "slide" from the current value to the new value- Returns:
- If the change has been applied
-
getIngameTimeRemaining
int getIngameTimeRemaining()Returns how much time is left (in seconds) until an active match is ending.The state has to be
ArenaStatus.RUNNING
and the timer has to actually be active (isIngameTimerTicking()
), otherwise this method returns -1.- Returns:
- The time in ticks until a match is ending. -1 when the timer isn't running
-
setIngameTimeRemaining
void setIngameTimeRemaining(int timeInSeconds) Set the time (in seconds) until an active match is ending.- Parameters:
timeInSeconds
- The new time in seconds
-
isIngameTimerTicking
boolean isIngameTimerTicking()Returns whether or not currently the ingame timer is countding down- Returns:
true
when the ingame timer is currently active
-
setLobbyTimeRemaining
default boolean setLobbyTimeRemaining(double value) Set the new time until the lobby showdown is being executed.Might fail when the state isn't
ArenaStatus.LOBBY
.This method is similar to
setLobbyTimeRemaining(double, boolean)
, but passes true to the instant parameter.- Parameters:
value
- The new time until the lobby showdown is being executed- Returns:
- If the change has been applied
-
teleportHere
Teleports the player inside this arena. It has the same effect as if you'd write /bw arena tp.- Parameters:
player
- The player who shall get teleportedsendMessage
- If it shall send a success/error message to the player error not.- See Also:
-
teleportHere
Teleports the player inside this arena. It has the same effect as if you'd write /bw arena tp.This method is similar to
teleportHere(Player, boolean)
, but won't display any success or error message to the player.- Parameters:
player
- The player who shall get teleported- See Also:
-
teleport
Usually the plugin prevents players from getting teleported and automatically kicks them from the game if they try to. If that's the case depends on the configuration of the player (more exact on the kick-outofarena config).- Parameters:
player
- The player who shall get teleportedtarget
- The location to which he shall get teleported to
-
setBlockPlayerPlaced
There are configurations which limit the block breaking to blocks that have been placed by players. Using this method you're able to mark blocks as player placed. UseGameAPI.isPlayerBlockMarkingSupported()
to check if it's enabled.- Parameters:
block
- The block that shall be marked/unmarked as player-placednewState
-true
if it has been placed by a player- See Also:
-
isBlockPlayerPlaced
There are configurations which limit the block breaking to blocks that have been placed by players. Using this method you'll be able to check if a block has been placed by a player. UseGameAPI.isPlayerBlockMarkingSupported()
to check if has been enabled by the user, otherwise this method always returns false.- Parameters:
block
- The block that shall be checked- Returns:
true
if it has been placed by a player- See Also:
-
canPlaceBlockAt
Returns whether a player would be able to place a block at a specific location. Generally the plugin limits the places where it's possible to place a block, you may use this method to identify where it is or not.You may pass the material of the block that'd theoretically be placed at the given location. It's not possible to place some certain types of materials, passing a non-null value will make the check more strict. Make sure it's actually a Material for a block, and not one for an item as it'll be more likely that the check will fail in that case.
Keep in mind that it won't actually place the block. You may use the following example for simulating a block that's being placed by a player:
Arena arena = ...; Block target = ...; Material newMaterial = Material.STONE; if (arena.canPlaceBlockAt(target, newMaterial)) { target.setType(newMaterial); arena.setBlockPlayerPlaced(target, true); }
- Parameters:
loc
- The location of the theoretical blockblockMaterial
- (Optional) the material of the block that'd theoretically be placed. Usenull
to not check that as well- Returns:
true
when a player could place a block at the given location
-
canPlaceBlockAt
Returns whether a player would be able to place a block at a specific location. Generally the plugin limits the places where it's possible to place a block, you may use this method to identify where it is or not.You may pass the material of the block that'd theoretically be placed at the given location. It's not possible to place some certain types of materials, passing a non-null value will make the check more strict. Make sure it's actually a Material for a block, and not one for an item as it'll be more likely that the check will fail in that case.
Keep in mind that it won't actually place the block. You may use the following example for simulating a block that's being placed by a player:
Arena arena = ...; Block target = ...; Material newMaterial = Material.STONE; if (arena.canPlaceBlockAt(target, newMaterial)) { target.setType(newMaterial); arena.setBlockPlayerPlaced(target, true); }
- Parameters:
block
- The theoretical blockblockMaterial
- (Optional) the material of the block that'd theoretically be placed. Usenull
to not check that as well- Returns:
true
when a player could place a block at the given location
-
canPlaceBlockAt
Returns whether a player would be able to place a block at a specific location. Generally the plugin limits the places where it's possible to place a block, you may use this method to identify where it is or not.You might want to use
canPlaceBlockAt(Location, Material)
to additionally check whether it's possible to place a certain material of a block.- Parameters:
loc
- The location of the theoretical block- Returns:
true
when a player could place a block at the given location
-
canPlaceBlockAt
Returns whether a player would be able to place a block at a specific location. Generally the plugin limits the places where it's possible to place a block, you may use this method to identify where it is or not.You might want to use
canPlaceBlockAt(Block, Material)
to additionally check whether it's possible to place a certain material of a block.- Parameters:
block
- The theoretical block- Returns:
true
when a player could place a block at the given location
-
getItemsGivenOnSpawn
Collection<ItemStack> getItemsGivenOnSpawn(Player player, Team team, boolean firstSpawn, boolean includeKeepOnDeath) Returns all the ItemStacks that will be given to a player when they spawn with all dyes already applied, and enchantments added.- Parameters:
player
- the player that the list of items should be generated forteam
- the team the items shall be generated for (used for dyeing, and getting team upgrade enchants)firstSpawn
- if we are assuming this is a first spawn or a respawnincludeKeepOnDeath
- if the list should include keep-on-death items- Returns:
- all the ItemStacks that would be given to the player when they spawn
-
formatItemStack
Returns the same ItemStack but possibly dyed or enchanted depending on team upgrades, and previous player purchases.- Parameters:
itemStack
- the ItemStack we want team characteristics to be applied toplayer
- the player that the item should be formatted for (used to gather correct enchants)team
- the team the item should be formatted for (used to apply dyes, and gather team upgrade enchants)- Returns:
- the formatted version of the same ItemStack
-
canPlayerBypassTrap
Whether or not a player can bypass team traps- Parameters:
player
- the player we are checking- Returns:
- whether or not they have the ability to bypass traps
-
isPlayerTrapBypassKeepOnDeath
Whether or not the players ability to bypass teams traps will remain if they die. Will also return false if the player does not currently have the ability- Parameters:
player
- the player we are checking- Returns:
- if the ability to bypass traps is kept on death
-
removePlayerTrapBypass
Removes a player's ability to bypass team traps- Parameters:
player
- the player who is losing the ability to bypass traps
-
addPlayerTrapBypass
Gives a player the ability to bypass team traps- Parameters:
player
- the player gaining the ability to bypass team trapskeepOnDeath
- whether or not this ability should be persistent on death
-
isRegenerationBlocksSavingProcessRunning
boolean isRegenerationBlocksSavingProcessRunning()The saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async. This method returns if it's currently running or not.- Returns:
- Whether the arenas inside the block are currently being fetched and saved.
- See Also:
-
runRegenerationBlocksSavingProcess
The saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async. This method runs the process.Keep in mind that the arena has to be stopped (
ArenaStatus.STOPPED
and the process may not be running alreadyisRegenerationBlocksSavingProcessRunning()
. The optional callback will immediatly returnfalse
in those cases.- Parameters:
finishCallback
- Gets called (possibly in a second thread) when the process is done. The parameter inside the callback tells you if the process was sucessfull or not.- See Also:
-
runRegenerationBlocksSavingProcess
default void runRegenerationBlocksSavingProcess()The saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async. This method runs the process.Keep in mind that the arena has to be stopped (
ArenaStatus.STOPPED
and the process may not be running alreadyisRegenerationBlocksSavingProcessRunning()
. You might want to userunRegenerationBlocksSavingProcess(Consumer)
if you want to know when it is done.- See Also:
-
getDefaultIssues
Returns all the issues that were detected by this plugin (and not manually added by others) that prevent the arena from running.You most likely want to use
getIssues(CommandSender)
instead as other plugins are able to add their own issues as well using theArenaIssuesCheckEvent
. This method does not count those in.- Parameters:
sender
- Will translate the message into the language of the sender. Passingnull
causes it to be in the default configured language- Returns:
- All the issues that prevent it from running. If there are none then there's nothing preventing it.
- See Also:
-
getDefaultIssues
Returns all the issues that were detected by this plugin (and not manually added by others) that prevent the arena from running.You most likely want to use
getIssues()
instead as other plugins are able to add their own issues as well using theArenaIssuesCheckEvent
. This method does not count those in.- Returns:
- All the issues that prevent it from running. If there are none then there's nothing preventing it.
- See Also:
-
getIssues
Returns all the issues that prevent the arena from running.It'll use
The plugin uses the same method when it loads all the arenas during start up or when manually trying to start an arena.ArenaIssuesCheckEvent
as well to check wether other plugins added additional issues.- Parameters:
sender
- Will translate the message into the language of the sender. Passingnull
causes it to be in the default configured language- Returns:
- All the issues that prevent it from running. If there are none then there's nothing preventing it.
- See Also:
-
getIssues
Set<ArenaIssuesCheckEvent.Issue> getIssues()Returns all the issues that prevent the arena from running.It'll use
ArenaIssuesCheckEvent
as well to check wether other plugins added additional issues.The plugin uses the same method when it loads all the arenas during start up or when manually trying to start an arena.
- Returns:
- All the issues that prevent it from running. If there are none then there's nothing preventing it.
- See Also:
-
getBuyGroupLevel
Returns the current buy-group level of the player.Returns
BuyGroup.getLowestLevel()
as the initial value for players, even in cases when the given player is not playing in the arena.- Parameters:
player
- The player whose level in the buy-group we want to findgroup
- The corresponding buy-group- Returns:
- The players current level in the buy-group
- See Also:
-
setBuyGroupLevel
Modify the buy-group level of the player.It doesn't have any effect when the given player is not playing inside the arena and the arena currently isn't running
ArenaStatus.RUNNING
.- Parameters:
player
- The player whose level we want to changegroup
- The corresponding buy-grouplevel
- The new level- See Also:
-
getSpectatorSpawn
Returns the spawnpoint of a spectator.It's possible that the method returns
null
as it's not required to have it set for a running arena. The plugin decides for a random points inside the arena if none is set.- Returns:
- The spawnpoint for spectators, possibly
null
-
setSpectatorSpawn
Set the spawnpoint for spectators.It's okay for the value to be
null
as it's not required to have it set for a running arena. The plugin decides for a random points inside the arena if none is set.- Parameters:
location
- The new spawnpoint for spectators, possiblynull
-
getTeamPrivateInventory
Obtain a teams private inventory using this method.Each team has a private inventory during a match that can be accessed for instance by an ender chest (depending on the configuration). This method returns the exact inventory instance that will be opened when a player would interact with it.
- Parameters:
team
- The team that owns the inventory- Returns:
- The private inventory of the team.
null
when the match is not running or when the team is not enabled
-
getPlayerPrivateInventory
Obtain a players private chest inventory using this method.Each player has an a private inventory that they can access during a match using an Ender Chest. Note that that users can set Team Chests to be the Ender Chest block. In this case, this private chest inventory not be accessible to the player though an Ender Chest. See
getTeamPrivateInventory(Team)
for team chest inventories.- Parameters:
player
- the Player whose ender chest inventory we want to get- Returns:
- The private inventory of the player.
null
when the match is not running or when the player is not in a running arena
-
endMatch
Forcefully stop the match right now.This only works when the current state is
ArenaStatus.RUNNING
. The method will returnfalse
if it failed to end it.- Parameters:
winningTeam
- The team that has won the match. Usenull
to mark it as a draw- Returns:
- If it was successful or not
-
exists
boolean exists()Returns whether this arena is still existing.- Returns:
true
if it still exists
-
applyPlayerClimate
Applies the configured weather and time properties to the player.Uses
Player.setPlayerTime(long, boolean)
andPlayer.setPlayerWeather(WeatherType)
. What exactly will happen greatly varies on the configurations on the user (e.g. whether "no-rain" is enabled). This method is useful when you've been modifying the players climate manually and would like to change it back to the normal state.This method doesn't care whether the player is currently inside the arena or not.
- Parameters:
player
- The target player
-
isCloned
boolean isCloned()Returns whether this arena has been cloned from an other arena.Cloned arenas aren't getting saved.
In case this method returnstrue
, you may also expect a non-null value fromgetCloneParent()
.- Returns:
true
in case this arena has been cloned from an other arena- See Also:
-
getCloneParent
Gets the arena from which this arena has been cloned from.Returns
null
when this arena hasn't been cloned.- Returns:
- The arena from which this arena has been cloned from. May be
null
- See Also:
-
getClones
Arena[] getClones()Gets all arenas that were cloned using this arena (basically the child arenas).- Returns:
- All arenas that have been cloned from this arena
- See Also:
-
saveAsync
void saveAsync()Save the arenas current state. Does not include the blocks file.The process is being executed on a separate thread.
MBedwars is also handling file lockages and queues properly. This means that the saving process may not be executed immediately if there are prior tasks.
-
saveNow
void saveNow()Save the arenas current state. Does not include the blocks file.Note that the saving process is being executed on the same thread as yours.
MBedwars is also handling file lockages and queues properly. This means that the saving process may not be executed immediately if there are prior tasks.
-
setResetPlayerTimeOnQuit
void setResetPlayerTimeOnQuit(boolean newValue) Define whether the player's time should be reset to default after one leaves.It is being reset back to default after a new match is being started.
Whether it is true or default by default depends on whether always-day is enabled.Player.resetPlayerTime()
is being used.- Parameters:
newValue
- The new value
-
setResetPlayerWeatherOnQuit
void setResetPlayerWeatherOnQuit(boolean newValue) Define whether the player's weather should be reset to default after one leaves.It is being reset back to default after a new match is being started.
Whether it is true or default by default depends on whether no-rain is enabled.Player.resetPlayerWeather()
is being used.- Parameters:
newValue
- The new value
-
isResetPlayerTimeOnQuit
boolean isResetPlayerTimeOnQuit()Gets whether the player's time shall be reset to default after one leaves.It is being reset back to default after a new match is being started.
Whether it is true or default by default depends on whether always-day is enabled.Player.resetPlayerTime()
is being used.- Returns:
- The current value
-
isResetPlayerWeatherOnQuit
boolean isResetPlayerWeatherOnQuit()Gets whether the player's weather shall be reset to default after one leaves.It is being reset back to default after a new match is being started.
Whether it is true or default by default depends on whether no-rain is enabled.Player.resetPlayerWeather()
is being used.- Returns:
- The current value
-
getTeamByBaseLocation
Tries to fetch the team of a location that's inside a base.This method will return
null
if there's no team at the given position (if it's outside of all bases)- Parameters:
loc
- The location with which we shall check- Returns:
- The team's base that's at the given location.
null
if there's none - See Also:
-
getTeamByBaseLocation
Tries to fetch the team of a location that's inside a base.This method will return
null
if there's no team at the given position (if it's outside of all bases)- Parameters:
xyz
- The location with which we shall check- Returns:
- The team's base that's at the given location.
null
if there's none - See Also:
-
getPersistentStorage
ArenaPersistentStorage getPersistentStorage()Gets a helper class for storing persistent information for exactly this arena instance.It may also be used to synchronize between servers.
- Specified by:
getPersistentStorage
in interfacePersistentStorage.Holder
- Returns:
- The persistant storage of this arena
-
getNative
<T> T getNative()Returns the Arena instance that's being used internally.There's no real use for third-party developers.
- Type Parameters:
T
- Automatically casts the instance to the given generic- Returns:
- The native arena instance
-
broadcastCustomPropertyChange
void broadcastCustomPropertyChange()Broadcast that a custom property has been changed (e.g. the value of an arena picker).This may be useful if you e.g. want to forcefully redraw all Arena GUIs (across all servers), as a custom arena picker variable has changed, whereby the arena isn't supposed to be visible anymore.
This method also calls the
ArenaPropertyChangeEvent
and theRemoteArenaPropertiesChangeEvent
. -
getVoting
Returns the voting handler of this arena.Check whether it's a voting arena using
getRegenerationType()
.- Returns:
- The voting handler of this arena.
null
if it's not a voting arena
-
getParticipatingVotingPool
Returns the voting arena in which this arena is in the pool of.- Returns:
- The voting arena in which this arena is in the pool of.
null
if it's not in any
-
isPrizeForMatchEnabled
boolean isPrizeForMatchEnabled()Get whether prizes (rewards in form of e.g. coins) will be given to players during this match.This method resets itself back to
true
after the match has ended.- Returns:
- Whether prizes will be given to players during this match
- See Also:
-
addPrizeForMatchDisabledTicket
Set whether prizes (rewards in form of e.g. coins, achievements, stats ...) will be given to players during this match.This method resets itself back to
true
after the match has ended.The ticket id may be whatever you choose. It only has to be unique to keep the support for other plugins.
- Parameters:
ticketId
- The ticket id of whatever reason the prize for match has been disabled- See Also:
-
removePrizeForMatchDisabledTicket
Remove a ticket id from the list of reasons to disable prizes (rewards in form of e.g. coins, achievements, stats ...).- Parameters:
ticketId
- The ticket id of whatever reason the prize for match has been disabled- Returns:
true
if the ticket id has been removed- See Also:
-
getPrizeForMatchDisabledTickets
Get a list of ticket ids of whatever reason the prize for match has been disabled.- Returns:
- A list of ticket ids of whatever reason the prize for match has been disabled
- See Also:
-
asRemote
RemoteArena asRemote()Returns theRemoteArena
variant of this arena.- Returns:
- A (local) remote arena that represents this arena
- See Also:
-