Interface RemoteArena
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPlayer
(AddRemotePlayerInfo info, @Nullable Consumer<RemotePlayerAddResult> callback) Adds a player (or multiple players) into the arena.default void
addPlayer
(RemotePlayer player) Adds a player into the arena.default void
addPlayer
(RemotePlayer player, @Nullable Team team) Adds a player into the arena.default void
addPlayer
(RemotePlayer player, @Nullable Team team, @Nullable Consumer<RemotePlayerAddResult> callback) Adds a player into the arena.default void
addPlayer
(RemotePlayer player, @Nullable Consumer<RemotePlayerAddResult> callback) Adds a player into the arena.default void
addSpectator
(RemotePlayer player) Adds a spectator into the arena.default void
addSpectator
(RemotePlayer player, boolean ignoreArenaStatus) Adds a spectator into the arena.default void
addSpectator
(RemotePlayer player, boolean ignoreArenaStatus, Consumer<RemoteSpectatorAddResult> callback) Adds a spectator into the arena.default void
addSpectator
(RemotePlayer player, SpectateReason reason) Adds a spectator into the arena.default void
addSpectator
(RemotePlayer player, SpectateReason reason, boolean ignoreArenaStatus) Adds a spectator into the arena.void
addSpectator
(RemotePlayer player, SpectateReason reason, boolean ignoreArenaStatus, @Nullable Consumer<RemoteSpectatorAddResult> callback) Adds a spectator into the arena.default void
addSpectator
(RemotePlayer player, SpectateReason reason, @Nullable Consumer<RemoteSpectatorAddResult> callback) Adds a spectator into the arena.default void
addSpectator
(RemotePlayer player, @Nullable Consumer<RemoteSpectatorAddResult> callback) Adds a spectator into the arena.boolean
exists()
Returns whether this arena is still existing.String[]
Returns the authors of the arena.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.@Nullable String
Returns the name of the world in which the game is located at.getIcon()
Gets the icon of the arena.default Set
<ArenaIssuesCheckEvent.Issue> Gets the issues that prevent the arena from running-getIssues
(@Nullable CommandSender sender) Gets the issues that prevent the arena from running-@Nullable Arena
getLocal()
Gets the arena instance that is being represented by this arena.int
Calculates [teams amount] x [players per team] when using a normal arena.int
Returns the minimum amount of players that are needed to start match.getName()
Returns the unique name of the arena.Gets a helper class for storing persistent information for exactly this arena instance.int
Returns the amount of players that are currently playing on this arena.int
Returns the amount of players that can be in a team.Returns whatArena.getName()
would return on the server, in which the arena is located at.Returns the regeneration type aka the form/variant of the arena.Collection
<? extends RemotePlayer> Returns all the players that are currently playing on this arena.Gets the server on which the arena is being managed on.int
Returns the amount of players currently spectating the arena.Returns the current state of the arenaboolean
isLocal()
Gets whether the arena is located on our server, or if it's being managed by an other one.void
syncProperties
(RemoteArenaPropertiesChangeEvent.Property... properties) Forcefully request the server owing this arena to resend us up-to-date poperty information.default void
teleportHere
(RemotePlayer player) Teleports a player into the arena.default void
teleportHere
(RemotePlayer player, boolean sendMessage) Teleports a player into the arena.void
teleportHere
(RemotePlayer player, boolean sendMessage, @Nullable Consumer<Boolean> callback) Teleports a player into the arena.default void
teleportHere
(RemotePlayer player, @Nullable Consumer<Boolean> callback) Teleports a player into the arena.
-
Method Details
-
getName
String getName()Returns the unique name of the arena.This name might has been changed in order to retain compatibility with the other existing arenas. For instance, it might have a @ prefix to indiciate that it's non-local arena. It might also contain a # suffix with a number, in case there are multiple arenas with the same name. Because of that, the name likely differs on other servers.
Use
getRealName()
if you'd like to get the actual name with out the suffixes and prefixes.
UsegetDisplayName()
if you'd like to the name that shall be displayed to players.- Returns:
- Returns the name of the arena
-
getRealName
String getRealName()Returns whatArena.getName()
would return on the server, in which the arena is located at.Basically, it returns
getName()
without the prefixes and suffixes. If the arena is local, then it's equal togetName()
.- Returns:
- The actual name without any suffix
-
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
-
isLocal
boolean isLocal()Gets whether the arena is located on our server, or if it's being managed by an other one.- Returns:
true
: it's being managed by this server
-
getLocal
Gets the arena instance that is being represented by this arena.Returns
null
in case it is not local. UseisLocal()
to check that.- Returns:
- The local arena. May be
null
-
getRemoteServer
RemoteServer getRemoteServer()Gets the server on which the arena is being managed on.Will return the same as
RemoteAPI.getLocalServer()
in caseisLocal()
returns true.- Returns:
- The server on which the arena is located on
-
getStatus
ArenaStatus getStatus()Returns the current state of the arena- Returns:
- The current state of the arena
-
getRegenerationType
RegenerationType getRegenerationType()Returns the regeneration type aka the form/variant of the arena.- Returns:
- The regeneration type of the arena
-
getRemotePlayers
Collection<? extends RemotePlayer> getRemotePlayers()Returns all the players that are currently playing on this arena.This does not include spectators.
- Returns:
- A collection of all playing players
-
getPlayersCount
int getPlayersCount()Returns the amount of players that are currently playing on this arena.This does not include spectators.
- Returns:
- The amount of players that are playing on this arena
-
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
-
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
-
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
-
getEnabledTeams
Returns every team that has been enabled for this arena.- Returns:
- All added teams
-
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
-
getIcon
ItemStack getIcon()Gets the icon of the arena.- Returns:
- The icon that's being used in GUIs
-
getSpectatorsCount
int getSpectatorsCount()Returns the amount of players currently spectating the arena.- Returns:
- The amount of spectators
-
getIssues
Gets the issues that prevent the arena from running-- 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.
-
getIssues
Gets the issues that prevent the arena from running-- Returns:
- All the issues that prevent it from running. If there are none then there's nothing preventing it.
-
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
-
addPlayer
void addPlayer(AddRemotePlayerInfo info, @Nullable @Nullable Consumer<RemotePlayerAddResult> callback) Adds a player (or multiple players) into the arena.- Parameters:
info
- The object containing all the info requiredcallback
- Gets called to notify you whether it was successful or not. May benull
-
addPlayer
default void addPlayer(RemotePlayer player, @Nullable @Nullable Team team, @Nullable @Nullable Consumer<RemotePlayerAddResult> callback) Adds a player into the arena.- Parameters:
player
- The player that shall get added into the arenateam
- The team it shall automatically join when entering it. May benull
callback
- Gets called to notify you whether it was successful or not. May benull
-
addPlayer
default void addPlayer(RemotePlayer player, @Nullable @Nullable Consumer<RemotePlayerAddResult> callback) Adds a player into the arena.- Parameters:
player
- The player that shall get added into the arenacallback
- Gets called to notify you whether it was successful or not. May benull
-
addPlayer
Adds a player into the arena.- Parameters:
player
- The player that shall get added into the arena
-
addPlayer
Adds a player into the arena.- Parameters:
player
- The player that shall get added into the arenateam
- The team it shall automatically join when entering it. May benull
-
addSpectator
void addSpectator(RemotePlayer player, SpectateReason reason, boolean ignoreArenaStatus, @Nullable @Nullable Consumer<RemoteSpectatorAddResult> callback) Adds a spectator into the arena.- Parameters:
player
- The player that shall be a spectatorreason
- The cause that made him into a spectatorignoreArenaStatus
-true
: will be able to be one, even if the arena is not runningcallback
- Gets called to notify you whether it was successful or not. May benull
-
addSpectator
default void addSpectator(RemotePlayer player, SpectateReason reason, @Nullable @Nullable Consumer<RemoteSpectatorAddResult> callback) Adds a spectator into the arena.- Parameters:
player
- The player that shall be a spectatorreason
- The cause that made him into a spectatorcallback
- Gets called to notify you whether it was successful or not. May benull
-
addSpectator
default void addSpectator(RemotePlayer player, @Nullable @Nullable Consumer<RemoteSpectatorAddResult> callback) Adds a spectator into the arena.- Parameters:
player
- The player that shall be a spectatorcallback
- Gets called to notify you whether it was successful or not. May benull
-
addSpectator
default void addSpectator(RemotePlayer player, boolean ignoreArenaStatus, Consumer<RemoteSpectatorAddResult> callback) Adds a spectator into the arena.- Parameters:
player
- The player that shall be a spectatorignoreArenaStatus
-true
: will be able to be one, even if the arena is not runningcallback
- Gets called to notify you whether it was successful or not. May benull
-
addSpectator
Adds a spectator into the arena.- Parameters:
player
- The player that shall be a spectatorreason
- The cause that made him into a spectatorignoreArenaStatus
-true
: will be able to be one, even if the arena is not running
-
addSpectator
Adds a spectator into the arena.- Parameters:
player
- The player that shall be a spectatorreason
- The cause that made him into a spectator
-
addSpectator
Adds a spectator into the arena.- Parameters:
player
- The player that shall be a spectator
-
addSpectator
Adds a spectator into the arena.- Parameters:
player
- The player that shall be a spectatorignoreArenaStatus
-true
: will be able to be one, even if the arena is not running
-
teleportHere
void teleportHere(RemotePlayer player, boolean sendMessage, @Nullable @Nullable Consumer<Boolean> callback) Teleports a player into the arena. He will not play in it!Basically the same as /bw arena teleport.
- Parameters:
player
- The player that shall get movedsendMessage
- Whether a message shall be sent to the player to notify about its success or failurecallback
- Gets called to notify you whether it was successful or not. May benull
-
teleportHere
Teleports a player into the arena. He will not play in it!Basically the same as /bw arena teleport.
- Parameters:
player
- The player that shall get movedsendMessage
- Whether a message shall be sent to the player to notify about its success or failure
-
teleportHere
Teleports a player into the arena. He will not play in it!Basically the same as /bw arena teleport.
- Parameters:
player
- The player that shall get moved
-
teleportHere
Teleports a player into the arena. He will not play in it!Basically the same as /bw arena teleport.
- Parameters:
player
- The player that shall get movedcallback
- Gets called to notify you whether it was successful or not. May benull
-
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.
- Returns:
- The persistant storage of this arena
-
syncProperties
Forcefully request the server owing this arena to resend us up-to-date poperty information.Generally the plugin does this automatically, but you may want to do it manually in some cases. In case everything went successfull, then
RemoteArenaPropertiesChangeEvent
will be called.- Parameters:
properties
- The properties that shall be synchronized with our server- Throws:
IllegalArgumentException
- In case the properties are emptyIllegalArgumentException
- If a given property isn't supported
-
exists
boolean exists()Returns whether this arena is still existing.- Returns:
true
if it still exists
-