Interface RemoteArena


public interface RemoteArena
Represents an arena that is located on another server, or on this server.
  • 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.
      Use getDisplayName() if you'd like to the name that shall be displayed to players.

      Returns:
      Returns the name of the arena
    • getRealName

      String getRealName()
      Returns what Arena.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 to getName().

      Returns:
      The actual name without any suffix
    • getDisplayName

      String getDisplayName()
      Returns the non-unique name of the arena for displaying to players

      Uses 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

      @Nullable @Nullable Arena getLocal()
      Gets the arena instance that is being represented by this arena.

      Returns null in case it is not local. Use isLocal() 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 case isLocal() 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

      Set<Team> 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

      String getDisplayedAuthors(@Nullable @Nullable CommandSender sender)
      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

      Set<ArenaIssuesCheckEvent.Issue> getIssues(@Nullable @Nullable CommandSender sender)
      Gets the issues that prevent the arena from running-
      Parameters:
      sender - Will translate the message into the language of the sender. Passing null 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

      default Set<ArenaIssuesCheckEvent.Issue> 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

      @Nullable @Nullable 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
    • 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 required
      callback - Gets called to notify you whether it was successful or not. May be null
    • 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 arena
      team - The team it shall automatically join when entering it. May be null
      callback - Gets called to notify you whether it was successful or not. May be null
    • 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 arena
      callback - Gets called to notify you whether it was successful or not. May be null
    • addPlayer

      default void addPlayer(RemotePlayer player)
      Adds a player into the arena.
      Parameters:
      player - The player that shall get added into the arena
    • addPlayer

      default void addPlayer(RemotePlayer player, @Nullable @Nullable Team team)
      Adds a player into the arena.
      Parameters:
      player - The player that shall get added into the arena
      team - The team it shall automatically join when entering it. May be null
    • 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 spectator
      reason - The cause that made him into a spectator
      ignoreArenaStatus - true: will be able to be one, even if the arena is not running
      callback - Gets called to notify you whether it was successful or not. May be null
    • 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 spectator
      reason - The cause that made him into a spectator
      callback - Gets called to notify you whether it was successful or not. May be null
    • 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 spectator
      callback - Gets called to notify you whether it was successful or not. May be null
    • 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 spectator
      ignoreArenaStatus - true: will be able to be one, even if the arena is not running
      callback - Gets called to notify you whether it was successful or not. May be null
    • addSpectator

      default void addSpectator(RemotePlayer player, SpectateReason reason, boolean ignoreArenaStatus)
      Adds a spectator into the arena.
      Parameters:
      player - The player that shall be a spectator
      reason - The cause that made him into a spectator
      ignoreArenaStatus - true: will be able to be one, even if the arena is not running
    • addSpectator

      default void addSpectator(RemotePlayer player, SpectateReason reason)
      Adds a spectator into the arena.
      Parameters:
      player - The player that shall be a spectator
      reason - The cause that made him into a spectator
    • addSpectator

      default void addSpectator(RemotePlayer player)
      Adds a spectator into the arena.
      Parameters:
      player - The player that shall be a spectator
    • addSpectator

      default void addSpectator(RemotePlayer player, boolean ignoreArenaStatus)
      Adds a spectator into the arena.
      Parameters:
      player - The player that shall be a spectator
      ignoreArenaStatus - 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 moved
      sendMessage - Whether a message shall be sent to the player to notify about its success or failure
      callback - Gets called to notify you whether it was successful or not. May be null
    • teleportHere

      default void teleportHere(RemotePlayer player, boolean sendMessage)
      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
      sendMessage - Whether a message shall be sent to the player to notify about its success or failure
    • teleportHere

      default void teleportHere(RemotePlayer player)
      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

      default void teleportHere(RemotePlayer player, @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 moved
      callback - Gets called to notify you whether it was successful or not. May be null
    • 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

      void syncProperties(RemoteArenaPropertiesChangeEvent.Property... properties)
      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 empty
      IllegalArgumentException - If a given property isn't supported
    • exists

      boolean exists()
      Returns whether this arena is still existing.
      Returns:
      true if it still exists