Interface RemotePlayer


public interface RemotePlayer
Represents a player on the network.

This includes the ones that are online on this server and the ones who are online on other ones.
Also keep in mind that this instance gets replaced with an other one whenever he changes servers, meaning that most of the methods won't work in that case. Use isOnline() to check that.

  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Player
    Gets the Player instance in case he is playing on this server.
    default void
    Makes the player connect with another server.
    void
    connectTo(String channelName)
    Makes the player connect with another server.
    @Nullable RemoteArena
    Returns the arena that he is currently playing in or spectating.
    long
    Get the time since when we know that the player has joined the given server (not the network!).
    The name of the player.
    Gets the server in which he's currently on.
    The unique id of the player.
    boolean
    Gets whether the player is currently playing on this server and not on another one.
    boolean
    Gets whether he is currently online.
    boolean
    Returns whether he is playing a match (also includes the lobby state).
    boolean
    Returns whether he is currently spectating an arena.
    void
    sendMessage(String... messages)
    Sends messages to the player.
    void
    sendMessage(net.md_5.bungee.api.chat.BaseComponent... components)
    Sends a message to the player.
    void
    Causes a player to get teleported to the hub server.
  • Method Details

    • getName

      String getName()
      The name of the player.

      Exactly the same as HumanEntity.getName().

      Returns:
      His name
    • getUniqueId

      UUID getUniqueId()
      The unique id of the player.

      Exactly the same as Entity.getUniqueId().

      Returns:
      His uuid
    • sendMessage

      void sendMessage(String... messages)
      Sends messages to the player.
      Parameters:
      messages - The messages that shall be sent
    • sendMessage

      void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components)
      Sends a message to the player.
      Parameters:
      components - The components of the message that shall be sent
    • getServer

      RemoteServer getServer()
      Gets the server in which he's currently on.
      Returns:
      The server he is playing on
    • getArena

      @Nullable @Nullable RemoteArena getArena()
      Returns the arena that he is currently playing in or spectating.
      Returns:
      The arena he attends. null when he isn't
    • isPlaying

      boolean isPlaying()
      Returns whether he is playing a match (also includes the lobby state).
      Returns:
      true when he's a part of a match
    • isSpectating

      boolean isSpectating()
      Returns whether he is currently spectating an arena.
      Returns:
      true when he's spectating an arena
    • isOnline

      boolean isOnline()
      Gets whether he is currently online.

      Keep in mind that this instance gets replaced with an other one when he switches the servers. In this case, this method will return false for this one, while the new instance will return true.

      Returns:
      Whether he is currently online
    • isLocal

      boolean isLocal()
      Gets whether the player is currently playing on this server and not on another one.
      Returns:
      true he is a player on this server
    • asBukkit

      @Nullable @Nullable Player asBukkit()
      Gets the Player instance in case he is playing on this server.
      Returns:
      Bukkit's player instance of this player. null when he's either not online or playing on another server.
    • connectTo

      void connectTo(String channelName)
      Makes the player connect with another server.
      Parameters:
      channelName - The name of the server that has been configured in BungeeCord's configs
    • connectTo

      default void connectTo(RemoteServer server)
      Makes the player connect with another server.
      Parameters:
      server - The target server
    • sendToHub

      void sendToHub()
      Causes a player to get teleported to the hub server.

      It's possible that nothing will happen when he's already on a hub server.

    • getLoginTime

      long getLoginTime()
      Get the time since when we know that the player has joined the given server (not the network!).
      Returns:
      The time in millis when the player has joined the given server