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 TypeMethodDescriptionvoidAdds an author.voidaddAuthors(Collection<String> authors) Adds multiple authors.default @Nullable AddPlayerIssueSame asaddPlayer(Player, Team, AddPlayerCause), but player won't join any team automatically and passesAddPlayerCause.PLUGINas the reason for the player joining the arena.default @Nullable AddPlayerIssueSame asaddPlayer(Player, Team, AddPlayerCause), passesAddPlayerCause.PLUGINas the reason for the player joining the arena.@Nullable AddPlayerIssueaddPlayer(Player player, @Nullable Team team, AddPlayerCause cause) Tries to add the player to the arena.voidaddPlayerTrapBypass(Player player, boolean keepOnDeath) Gives a player the ability to bypass team trapsvoidaddPrizeForMatchDisabledTicket(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 SpectatoraddSpectator(Player player) Same asaddSpectator(Player, SpectateReason).@Nullable SpectatoraddSpectator(Player player, SpectateReason reason) Adds a player as a spectator.voidaddTeamEffect(Team team, boolean baseOnly, PotionEffectType potionEffectType, int amplifier) Adds an effect for all the players in a certain teamvoidaddTeamEnchantment(Team team, TeamEnchantment teamEnchantment) Adds a team enchantment to a team, and applies it to team playersvoidapplyPlayerClimate(Player player) Applies the configured weather and time properties to the player.asRemote()Returns theRemoteArenavariant of this arena.voidSends this message to every player and spectatorvoidPlays the sound to every player and spectatorvoidSends this message to every player and spectatorvoidBroadcast that a custom property has been changed (e.g. the value of an arena picker).default booleancanPlaceBlockAt(Block block) Returns whether a player would be able to place a block at a specific location.default booleancanPlaceBlockAt(Block block, @Nullable Material blockMaterial) Deprecated.Might break in the future when Spigot releases their BlockType APIdefault booleancanPlaceBlockAt(Location loc) Returns whether a player would be able to place a block at a specific location.booleancanPlaceBlockAt(Location loc, @Nullable Material blockMaterial) Deprecated.Might break in the future when Spigot releases their BlockType APIbooleancanPlayerBypassTrap(Player player) Whether or not a player can bypass team trapsvoiddestroyBed(Team team) Tries to break/destroy the bed of a team.voiddestroyBedBlocks(Team team) Tries to break/destroy the bed blocks of a team, but not change the internal state.@Nullable ArenaBedBreakEventWill destroy the bed as if a player actually broke it ingame.default @Nullable ArenaBedBreakEventdestroyBedNaturally(Team team, @Nullable Player player) Will destroy the bed as if a player actually broke it ingame.booleanForcefully stop the match right now.booleanexists()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.doubleThis method calculates an approximate duration of the regeneration of an arena.String[]Returns the authors of the arena.@Nullable InstantgetBedDestructionTime(Team team) Get the time when the bed of a team has been destroyed.@Nullable HologramEntitygetBedHologram(Team team) Gets the hologram that is optionally being spawned above the team's bed.@Nullable XYZDgetBedLocation(Team team) Returns the location the team's bed location.Block[]getBedParts(Team team) Returns the blocks of all the team's bed parts.voidgetBedPartsAsync(Team team, Consumer<Block[]> callback) Returns the blocks of all the team's bed parts.intgetBuyGroupLevel(Player player, BuyGroup group) Returns the current buy-group level of the player.@Nullable InventorygetChestInventory(Block block, Player player) Get the inventory the player would see with the given special chest.getChestType(Block block) Get the type of a special chest existing within the arena.@Nullable ArenaGets 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.@Nullable FileGet the folder in which the arena's data is stored.@Nullable FileGet the file that contains the regeneration data of this 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 WorldReturns 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.intReturns 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 LocationThe lobby location which can be set with /bw arena setlobbydoubleReturns how much time is left until the game starts (ArenaStatus.LOBBY) or until all players get kicked (ArenaStatus.END_LOBBY).intCalculates [teams amount] x [players per team] when using a normal arena.@Nullable XYZAn arena of the typeRegenerationType.REGIONhas two corners.intReturns the minimum amount of players that are needed to start match.@Nullable XYZAn arena of the typeRegenerationType.REGIONhas two corners.getName()Returns the unique name of the arena.<T> TReturns the Arena instance that's being used internally.@Nullable ArenaReturns 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 InventorygetPlayerPrivateInventory(Player player) Obtain a players private chest inventory using this method.Returns all players (except spectators) who are inside the lobby/match playing.getPlayersInTeam(@Nullable Team team) Returns a List of all players that are in a specific team.intReturns the amount of players that can be in a team.@Nullable TeamgetPlayerTeam(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 QuitPlayerMemorygetQuitPlayerMemory(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 InstantReturns the time when the arena changed the last time its state toArenaStatus.RUNNING.@Nullable InstantReturns the time when the arena has ended (forceful state changes don't count).@Nullable DurationGet 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/locationGet all the active special item sessions.@Nullable SpectatorgetSpectateData(Player player) Looks and returns the spectator data of the player.Returns every player who's currently spectating this arena.@Nullable XYZYPReturns the spawnpoint of a spectator.Returns the current state of the arenagetTeamBaseOnlyEffects(Team team) Returns effects applied to a team around their base@Nullable TeamgetTeamByBaseLocation(XYZ xyz) Tries to fetch the team of a location that's inside a base.@Nullable TeamTries to fetch the team of a location that's inside a base.@Nullable TeamgetTeamByBedBlock(IntXYZ loc) Returns the team that owns the bed part at the given location.@Nullable TeamgetTeamByBedBlock(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 InventorygetTeamPrivateInventory(Team team) Obtain a teams private inventory using this method.@Nullable XYZYPgetTeamSpawn(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.Gets the arena'sArenaTimeType@Nullable UpgradeStategetUpgradeState(Team team) Returns the UpgradeState of a specified team@Nullable ArenaVotingHandlerReturns the voting handler of this arena.Gets the arena'sArenaWeatherTypedefault booleanReturns whether a location for the lobby has been set.booleanisBedDestroyed(Team team) Returns whether the bed of a team has been destroyed.booleanisBlockPlayerPlaced(Block block) There are configurations which limit the block breaking to blocks that have been placed by players.booleanisCloned()Returns whether this arena has been cloned from another arena.booleanReturns whether this arena has a custom name enabled that'll be displayed (getDisplayName()) in favor of the actual name (getName()).booleanReturns whether or not currently the ingame timer is countding downbooleanChecks whether the given location is inside the arena.booleanChecks whether the given location is inside the arena.booleanChecks whether the given location is inside the arena.booleanisPlayerTrapBypassKeepOnDeath(Player player) Whether or not the players ability to bypass teams traps will remain if they die.booleanGet whether the player is currently playing in this arena.booleanGet whether prizes (rewards in form of e.g. coins) will be given to players during this match.booleanThe saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async.booleanGets whether the player's time shall be reset to default after one leaves.booleanGets whether the player's weather shall be reset to default after one leaves.booleanisSpectating(Player player) Checks whether the player is currently spectating this arena.booleanisTeamEnabled(Team team) Returns whether or not a team is enabled.default intDoes the same askickAllPlayers(KickReason), but usesKickReason.PLUGINas the reason.default intkickAllPlayers(KickReason reason) Kicks every player who's currently inside the arena.default intDoes the same askickAllSpectators(KickSpectatorReason), but usesKickSpectatorReason.PLUGINas the reason.default intkickAllSpectators(KickSpectatorReason reason) Kicks every spectator of this arenadefault booleankickPlayer(Player player) Does the same askickPlayer(Player, KickReason), but passesKickReason.PLUGINas the reason.booleankickPlayer(Player player, KickReason reason) Kicks the player from the arena.booleanleaveTeamDuringLobby(Player player) Simulates as if the player would manually leave his current team.booleanmoveToTeamDuringLobby(Player player, Team team) Simulates as if the player would manually want to change the team.voidTries to place the bed of a team.voidplaceBedBlocks(Team team) Tries to place the bed blocks of a team, but not change the internal state.@Nullable RejoinPlayerIssuerejoinPlayer(Player player) Tries to make the player rejoin an already active game.@Nullable RejoinPlayerIssuerejoinPlayer(Player player, @Nullable QuitPlayerMemory memory) Tries to make the player rejoin an already active game using some rejoin info contained in the memory.booleanremove()Removes the arena and kicks all playing players + spectators.intRemoves all existing authors.booleanremoveAuthor(String author) Removes an author.voidremovePlayerTrapBypass(Player player) Removes a player's ability to bypass team trapsbooleanremovePrizeForMatchDisabledTicket(String ticketId) Remove a ticket id from the list of reasons to disable prizes (rewards in form of e.g. coins, achievements, stats ...).booleanremoveTeamEffect(Team team, PotionEffectType potionEffectType) Removes an effect from a teambooleanremoveTeamEnchantment(Team team, TeamEnchantment teamEnchantment) Removes a team enchantment from a team, and applies it to team playersdefault voidThe saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async.voidrunRegenerationBlocksSavingProcess(@Nullable Consumer<Boolean> finishCallback) The saving process of the blocks inside the arenas (aka regeneration blocks) is being executed async.voidSave the arenas current state.voidsaveNow()Save the arenas current state.booleansetBedLocation(Team team, @Nullable XYZD loc) Sets the bed location of a team.voidsetBlockPlayerPlaced(Block block, boolean newState) There are configurations which limit the block breaking to blocks that have been placed by players.voidsetBuyGroupLevel(Player player, BuyGroup group, int level) Modify the buy-group level of the player.voidsetCustomName(String customName) Set the custom name of the arena.voidsetCustomNameEnabled(boolean customNameEnabled) Set whether this arena has a custom name enabled that'll be displayed (getDisplayName()) in favor of the actual name (getName()).voidsetGameWorld(@Nullable World world) Sets the world in which the game is located at.voidsetGameWorldName(@Nullable String name) Set the name of the world in which the game is located at.voidSet the new icon for the arena.voidsetIngameTimeRemaining(int timeInSeconds) Set the time (in seconds) until an active match is ending.voidsetLobbyLocation(@Nullable Location location) Set the location for the lobby to which the players will be teleported at when they join the arena.default booleansetLobbyTimeRemaining(double value) Set the new time until the lobby showdown is being executed.booleansetLobbyTimeRemaining(double value, boolean instant) Set the new time until the lobby showdown is being executed.voidsetMinPlayers(int minPlayers) Set the minimum amount of players that are needed to start a match.booleanChanges the name of the arena.voidsetPlayersPerTeam(int playersPerTeam) Set the amount of players that can be in a team.voidsetPlayerTeam(Player player, @Nullable Team team) Change the team of a player.voidThis method allows you to change the form of the arenavoidsetRegionCorners(XYZ pos1, XYZ pos2) An arena of the typeRegenerationType.REGIONhas two corners.voidsetResetPlayerTimeOnQuit(boolean newValue) Define whether the player's time should be reset to default after one leaves.voidsetResetPlayerWeatherOnQuit(boolean newValue) Define whether the player's weather should be reset to default after one leaves.voidsetSpectatorSpawn(@Nullable XYZYP location) Set the spawnpoint for spectators.voidsetStatus(ArenaStatus status) Not only changes the status, but also does operations depending on the status.booleansetTeamEnabled(Team team, boolean enabled) Enables or disables a team in this arena.booleansetTeamSpawn(Team team, @Nullable XYZYP loc) Set the spawn point of a team.voidsetTimeType(ArenaTimeType timeType) Sets the arena'sArenaTimeTypevoidsetWeatherType(ArenaWeatherType weatherType) Sets the arena'sArenaWeatherTypevoidUsually the plugin prevents players from getting teleported and automatically kicks them from the game if they try to.default voidteleportHere(Player player) Teleports the player inside this arena.voidteleportHere(Player player, boolean sendMessage) Teleports the player inside this arena.voidRemoves any set corners in the arena.voidForcefully 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:
truewhen 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-truecauses 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.RUNNINGand 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.NaNwhen 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:
trueif 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
nullif 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
nullif 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,nullif it shall be removed in the storage- Returns:
trueif 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.- Parameters:
team- The team that owns the bed- Returns:
- The time of when the bed has been destroyed. May be
nullif 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
nullif 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
nullwhen 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, usenullto remove it from the storage- Returns:
truewhen 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
nullif 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:
truewhen 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:
truewhen 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 benullif its unknown- Returns:
- The event containing the result. May be
nullif 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
nullif 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:
falseif 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.VOTINGthen 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. Usenullto reset it back to default (to remove it).- Parameters:
name- The new game world.nullto reset it back to default
-
getMinRegionCorner
An arena of the typeRegenerationType.REGIONhas two corners. This method returns the point with the lowest (Math.min(int, int)number.It returns
nullif 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.REGIONhas two corners. This method returns the point with the greatest (Math.max(int, int)number.It returns
nullif 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.REGIONhas 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
nullas 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, possiblynullto 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
nullto look for players that haven't picked a team (works only during lobby).- Parameters:
team- The team in which the players are.nullto 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
ignorePlayersto ignore these players in the result. Meaning it'll return all teams minusignorePlayersthat 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
ignorePlayersto ignore these players in the result. Meaning it'll return all teams minusignorePlayersthat 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
-
getWeatherType
ArenaWeatherType getWeatherType()Gets the arena'sArenaWeatherType- Returns:
- the arena's weather type
-
setWeatherType
Sets the arena'sArenaWeatherType- Parameters:
weatherType- the new arena weather type
-
getTimeType
ArenaTimeType getTimeType()Gets the arena'sArenaTimeType- Returns:
- the arena's time type
-
setTimeType
Sets the arena'sArenaTimeType- Parameters:
timeType- the new arena time type
-
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.PLUGINas 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.PLUGINas 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.LOBBYor 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.
nullwhen 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
memoryis 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.
nullwhen there wasn't any
-
kickPlayer
Does the same askickPlayer(Player, KickReason), but passesKickReason.PLUGINas the reason.- Parameters:
player- The player who shall get kicked- Returns:
- Returns
falseif 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
falseif the player isn't playing inside the arena, otherwisetrue
-
kickAllPlayers
default int kickAllPlayers()Does the same askickAllPlayers(KickReason), but usesKickReason.PLUGINas 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 returnnullwhen 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
nullas 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 passingnullas 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 whose team we want to changeteam- His new team- Returns:
trueif his team changed,falseif not
-
leaveTeamDuringLobby
Simulates as if the player would manually leave his current team.Sends messages etc. if it was successful or something went wrong.
- Parameters:
player- The player whose team we want to remove- Returns:
trueif his team has been removed,falseif not
-
getPlayers
Collection<Player> getPlayers()Returns all players (except spectators) who are inside the lobby/match playing.- Returns:
- All players who are currently inside the arena. Spectators are not included
-
isPlaying
Get whether the player is currently playing in this arena.This does not include spectators. This is just a more efficient check of
getPlayers().- Parameters:
player- The player we want to check- Returns:
trueif the player is currently playing in the arena
-
isSpectating
Checks whether the player is currently spectating this arena.This does not include players who are currently playing in the arena. There may be exceptions, where a player might be playing and spectating at the same time, such as when he is death spectating (waiting to respawn).
- Parameters:
player- The player we want to check- Returns:
trueif the player is currently spectating the arena
-
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.
nullwhen there isn't any
-
addSpectator
Same asaddSpectator(Player, SpectateReason).Uses
SpectateReason.PLUGINas 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.PLUGINas 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
nullif 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
nullif the arena hasn't ended yet or it got into theArenaStatus.LOBBYstate.- 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
nullif 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:
truewhen 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.
-1if 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. Iffalseit'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.RUNNINGand 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:
truewhen 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-trueif 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:
trueif it has been placed by a player- See Also:
-
canPlaceBlockAt
Deprecated.Might break in the future when Spigot releases their BlockType APIReturns 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. Usenullto not check that as well- Returns:
truewhen a player could place a block at the given location
-
canPlaceBlockAt
@Deprecated default boolean canPlaceBlockAt(Block block, @Nullable @Nullable Material blockMaterial) Deprecated.Might break in the future when Spigot releases their BlockType APIReturns 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. Usenullto not check that as well- Returns:
truewhen 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:
truewhen 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:
truewhen 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.STOPPEDand the process may not be running alreadyisRegenerationBlocksSavingProcessRunning(). The optional callback will immediatly returnfalsein 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.STOPPEDand 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. Passingnullcauses 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.ArenaIssuesCheckEventas well to check wether other plugins added additional issues.- Parameters:
sender- Will translate the message into the language of the sender. Passingnullcauses 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
ArenaIssuesCheckEventas 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
nullas 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
nullas 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.
nullwhen 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.
nullwhen 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 returnfalseif it failed to end it.- Parameters:
winningTeam- The team that has won the match. Usenullto mark it as a draw- Returns:
- If it was successful or not
-
exists
boolean exists()Returns whether this arena is still existing.- Returns:
trueif 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 another arena.Cloned arenas aren't getting saved.
In case this method returnstrue, you may also expect a non-null value fromgetCloneParent().- Returns:
truein 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
nullwhen 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
nullif 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.
nullif there's none - See Also:
-
getTeamByBaseLocation
Tries to fetch the team of a location that's inside a base.This method will return
nullif 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.
nullif 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:
getPersistentStoragein 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
ArenaPropertyChangeEventand 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.
nullif 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.
nullif 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
trueafter 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
trueafter 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:
trueif 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:
-
getChestType
Get the type of a special chest existing within the arena.- Parameters:
block- The block we want to check- Returns:
- The type of the chest.
nullif it's not a special chest - See Also:
-
getChestInventory
Get the inventory the player would see with the given special chest.Will return the vanilla block's inventory if it's not a special chest.
- Parameters:
block- The block we want to checkplayer- The player who wants to open the chest- Returns:
- The inventory the player would see with the given special chest.
nullif it's not a special chest - See Also:
-
getDataFolder
Get the folder in which the arena's data is stored.- Returns:
- The folder in which the arena's data is stored.
nullif it's a cloned arena
-
getDataRegenFile
Get the file that contains the regeneration data of this arena.It might not have one if it's cloned or
RegenerationType.isNormal()returnsfalse.- Returns:
- The file that contains the regeneration data of this arena.
nullif it doesn't have one
-
getSpecialItemSessions
Collection<SpecialItemUseSession> getSpecialItemSessions()Get all the active special item sessions.A special item might stay active longer. For instance, with fireballs they need to fly to their target first. Once they hit something or despawn, the session will be stopped.
- Returns:
- All the active special item sessions
-
asRemote
RemoteArena asRemote()Returns theRemoteArenavariant of this arena.- Returns:
- A (local) remote arena that represents this arena
- See Also:
-