Package net.md_5.bungee.api.connection

# Interface ProxiedPlayer

All Superinterfaces:
  `CommandSender`, `Connection`

All Known Subinterfaces:
  `ConnectedPlayer`

public interface ProxiedPlayer extends Connection, CommandSender
Represents a player whose connection is being connected to somewhere else, whether it be a remote or embedded server.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `ProxiedPlayer.ChatMode`
  Represents the player's chat state.
  `static enum`
  `ProxiedPlayer.MainHand`

  ## Nested classes/interfaces inherited from interface net.md_5.bungee.api.connection.Connection

  `Connection.Unsafe`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `chat(String message)`
  Make this player chat (say something), to the server he is currently on.
  `void`
  `clearDialog()`
  Clear the player's open dialog.
  `void`
  `connect(ServerInfo target)`
  Connects / transfers this user to the specified connection, gracefully closing the current one.
  `void`
  `connect(ServerInfo target, Callback<Boolean> callback)`
  Connects / transfers this user to the specified connection, gracefully closing the current one.
  `void`
  `connect(ServerInfo target, Callback<Boolean> callback, ServerConnectEvent.Reason reason)`
  Connects / transfers this user to the specified connection, gracefully closing the current one.
  `void`
  `connect(ServerInfo target, ServerConnectEvent.Reason reason)`
  Connects / transfers this user to the specified connection, gracefully closing the current one.
  `void`
  `connect(ServerConnectRequest request)`
  Connects / transfers this user to the specified connection, gracefully closing the current one.
  `ProxiedPlayer.ChatMode`
  `getChatMode()`
  Gets this player's chat mode.
  `String`
  `getClientBrand()`
  Gets the client brand of this player.
  `String`
  `getDisplayName()`
  Gets this player's display name.
  `Locale`
  `getLocale()`
  Gets this player's locale.
  `ProxiedPlayer.MainHand`
  `getMainHand()`
  Gets this player's main hand setting.
  `Map<String,String>`
  `getModList()`
  Gets this player's Forge Mod List, if the player has sent this information during the lifetime of their connection to Bungee.
  `PendingConnection`
  `getPendingConnection()`
  Get the pending connection that belongs to this player.
  `int`
  `getPing()`
  Gets the ping time between the proxy and this connection.
  `ServerInfo`
  `getReconnectServer()`
  Get the server which this player will be sent to next time the log in.
  `Scoreboard`
  `getScoreboard()`
  Deprecated.
  for internal use only, setters will not have the expected effect, will not update client state, and may corrupt proxy state
  `Server`
  `getServer()`
  Gets the server this player is connected to.
  `SkinConfiguration`
  `getSkinParts()`
  Gets this player's skin settings.
  `UUID`
  `getUniqueId()`
  Get this connection's UUID, if set.
  `String`
  `getUUID()`
  Deprecated.
  In favour of `getUniqueId()`
  `byte`
  `getViewDistance()`
  Gets this player's view distance.
  `boolean`
  `hasChatColors()`
  Gets if this player has chat colors enabled or disabled.
  `boolean`
  `isForgeUser()`
  Gets whether this player is using a FML client.
  `void`
  `resetTabHeader()`
  Clears the header and footer displayed in the tab player list.
  `CompletableFuture<byte[]>`
  `retrieveCookie(String cookie)`
  Retrieves a cookie from this player.
  `void`
  `sendData(String channel, byte[] data)`
  Send a plugin message to this player.
  `void`
  `sendMessage(UUID sender, BaseComponent message)`
  Send a message to this player.
  `void`
  `sendMessage(UUID sender, BaseComponent... message)`
  Send a message to this player.
  `void`
  `sendMessage(ChatMessageType position, BaseComponent message)`
  Send a message to the specified screen position of this player.
  `void`
  `sendMessage(ChatMessageType position, BaseComponent... message)`
  Send a message to the specified screen position of this player.
  `void`
  `sendServerLinks(List<ServerLink> serverLinks)`
  Sends server links to the player.
  `void`
  `sendTitle(Title title)`
  Sends a `Title` to this player.
  `void`
  `setDisplayName(String name)`
  Sets this player's display name to be used by proxy commands and plugins.
  `void`
  `setReconnectServer(ServerInfo server)`
  Set the server which this player will be sent to next time the log in.
  `void`
  `setTabHeader(BaseComponent[] header, BaseComponent[] footer)`
  Set the header and footer displayed in the tab player list.
  `void`
  `setTabHeader(BaseComponent header, BaseComponent footer)`
  Set the header and footer displayed in the tab player list.
  `void`
  `showDialog(Dialog dialog)`
  Show a dialog to the player.
  `void`
  `storeCookie(String cookie, byte[] data)`
  Stores a cookie in this player's client.
  `void`
  `transfer(String host, int port)`
  Requests this player to connect to a different server specified by host and port.

  ### Methods inherited from interface net.md_5.bungee.api.CommandSender

  `addGroups, getGroups, getName, getPermissions, hasPermission, removeGroups, sendMessage, sendMessage, sendMessage, sendMessages, setPermission`

  ### Methods inherited from interface net.md_5.bungee.api.connection.Connection

  `disconnect, disconnect, disconnect, getAddress, getSocketAddress, isConnected, unsafe`

- ## Method Details

  - ### getDisplayName

    String getDisplayName()
    Gets this player's display name.
    Returns:
      the players current display name

  - ### setDisplayName

    void setDisplayName(String name)
    Sets this player's display name to be used by proxy commands and plugins.
    Parameters:
      `name` - the name to set

  - ### sendMessage

    void sendMessage(ChatMessageType position, BaseComponent... message)
    Send a message to the specified screen position of this player.
    Parameters:
      `position` - the screen position
      `message` - the message to send

  - ### sendMessage

    void sendMessage(ChatMessageType position, BaseComponent message)
    Send a message to the specified screen position of this player.
    Parameters:
      `position` - the screen position
      `message` - the message to send

  - ### sendMessage

    void sendMessage(UUID sender, BaseComponent... message)
    Send a message to this player.
    Parameters:
      `sender` - the sender of the message
      `message` - the message to send

  - ### sendMessage

    void sendMessage(UUID sender, BaseComponent message)
    Send a message to this player.
    Parameters:
      `sender` - the sender of the message
      `message` - the message to send

  - ### connect

    void connect(ServerInfo target)
    Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
    Parameters:
      `target` - the new server to connect to

  - ### connect

    void connect(ServerInfo target, ServerConnectEvent.Reason reason)
    Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
    Parameters:
      `target` - the new server to connect to
      `reason` - the reason for connecting to the new server

  - ### connect

    void connect(ServerInfo target, Callback<Boolean> callback)
    Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
    Parameters:
      `target` - the new server to connect to
      `callback` - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success (true) or failure (false).

  - ### connect

    void connect(ServerInfo target, Callback<Boolean> callback, ServerConnectEvent.Reason reason)
    Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
    Parameters:
      `target` - the new server to connect to
      `callback` - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success (true) or failure (false).
      `reason` - the reason for connecting to the new server

  - ### connect

    void connect(ServerConnectRequest request)
    Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
    Parameters:
      `request` - request to connect with

  - ### getServer

    Server getServer()
    Gets the server this player is connected to.
    Returns:
      the server this player is connected to

  - ### getPing

    int getPing()
    Gets the ping time between the proxy and this connection.
    Returns:
      the current ping time

  - ### sendData

    void sendData(String channel, byte[] data)
    Send a plugin message to this player. In recent Minecraft versions channel names must contain a colon separator and consist of [a-z0-9/._-]. This will be enforced in a future version. The "BungeeCord" channel is an exception and may only take this form.
    Parameters:
      `channel` - the channel to send this data via
      `data` - the data to send

  - ### getPendingConnection

    PendingConnection getPendingConnection()
    Get the pending connection that belongs to this player.
    Returns:
      the pending connection that this player used

  - ### chat

    void chat(String message)
    Make this player chat (say something), to the server he is currently on.
    Parameters:
      `message` - the message to say

  - ### getReconnectServer

    ServerInfo getReconnectServer()
    Get the server which this player will be sent to next time the log in.
    Returns:
      the server, or null if default

  - ### setReconnectServer

    void setReconnectServer(ServerInfo server)
    Set the server which this player will be sent to next time the log in.
    Parameters:
      `server` - the server to set

  - ### getUUID

    @Deprecated String getUUID()
    Deprecated.
    In favour of `getUniqueId()`
    Get this connection's UUID, if set.
    Returns:
      the UUID

  - ### getUniqueId

    UUID getUniqueId()
    Get this connection's UUID, if set.
    Returns:
      the UUID

  - ### getLocale

    Locale getLocale()
    Gets this player's locale.
    Returns:
      the locale

  - ### getViewDistance

    byte getViewDistance()
    Gets this player's view distance.
    Returns:
      the view distance, or a reasonable default

  - ### getChatMode

    ProxiedPlayer.ChatMode getChatMode()
    Gets this player's chat mode.
    Returns:
      the chat flags set, or a reasonable default

  - ### hasChatColors

    boolean hasChatColors()
    Gets if this player has chat colors enabled or disabled.
    Returns:
      if chat colors are enabled

  - ### getSkinParts

    SkinConfiguration getSkinParts()
    Gets this player's skin settings.
    Returns:
      the players skin setting

  - ### getMainHand

    ProxiedPlayer.MainHand getMainHand()
    Gets this player's main hand setting.
    Returns:
      main hand setting

  - ### setTabHeader

    void setTabHeader(BaseComponent header, BaseComponent footer)
    Set the header and footer displayed in the tab player list.
    Parameters:
      `header` - The header for the tab player list, null to clear it.
      `footer` - The footer for the tab player list, null to clear it.

  - ### setTabHeader

    void setTabHeader(BaseComponent[] header, BaseComponent[] footer)
    Set the header and footer displayed in the tab player list.
    Parameters:
      `header` - The header for the tab player list, null to clear it.
      `footer` - The footer for the tab player list, null to clear it.

  - ### resetTabHeader

    void resetTabHeader()
    Clears the header and footer displayed in the tab player list.

  - ### sendTitle

    void sendTitle(Title title)
    Sends a `Title` to this player. This is the same as calling `Title.send(ProxiedPlayer)`.
    Parameters:
      `title` - The title to send to the player.
    See Also:
      - `Title`

  - ### isForgeUser

    boolean isForgeUser()
    Gets whether this player is using a FML client.

    This method is only reliable if BungeeCord links Minecraft 1.8 servers together, as Bungee can pick up whether a user is a Forge user with the initial handshake. If this is used for a 1.7 network, this might return `false` even if the user is a FML user, as Bungee can only determine this information if a handshake successfully completes.

    Returns:
      `true` if it is known that the user is using a FML client, `false` otherwise.

  - ### getModList

    Map<String,String> getModList()
    Gets this player's Forge Mod List, if the player has sent this information during the lifetime of their connection to Bungee. There is no guarantee that information is available at any time, as it is only sent during a FML handshake. Therefore, this will only contain information for a user that has attempted joined a Forge server.

    Consumers of this API should be aware that an empty mod list does not indicate that a user is not a Forge user, and so should not use this API to check for this. See the `isForgeUser` method instead.

    Calling this when handling a `ServerConnectedEvent` may be the best place to do so as this event occurs after a FML handshake has completed, if any has occurred.

    Returns:
      A `Map` of mods, where the key is the name of the mod, and the value is the version. Returns an empty list if the FML handshake has not occurred for this `ProxiedPlayer` yet.

  - ### getScoreboard

    @Deprecated Scoreboard getScoreboard()
    Deprecated.
    for internal use only, setters will not have the expected effect, will not update client state, and may corrupt proxy state
    Get the `Scoreboard` that belongs to this player.
    Returns:
      this player's `Scoreboard`

  - ### retrieveCookie

    @Experimental CompletableFuture<byte[]> retrieveCookie(String cookie)
    Retrieves a cookie from this player.
    Parameters:
      `cookie` - the resource location of the cookie, for example "bungeecord:my_cookie"
    Returns:
      a `CompletableFuture` that will be completed when the Cookie response is received. If the cookie is not set in the client, the `CompletableFuture` will complete with a null value
    Throws:
      `IllegalStateException` - if the player's version is not at least 1.20.5

  - ### storeCookie

    @Experimental void storeCookie(String cookie, byte[] data)
    Stores a cookie in this player's client.
    Parameters:
      `cookie` - the resource location of the cookie, for example "bungeecord:my_cookie"
      `data` - the data to store in the cookie
    Throws:
      `IllegalStateException` - if the player's version is not at least 1.20.5

  - ### transfer

    @Experimental void transfer(String host, int port)
    Requests this player to connect to a different server specified by host and port. This is a client-side transfer - host and port should not specify a BungeeCord backend server.
    Parameters:
      `host` - the host of the server to transfer to
      `port` - the port of the server to transfer to
    Throws:
      `IllegalStateException` - if the players version is not at least 1.20.5

  - ### getClientBrand

    String getClientBrand()
    Gets the client brand of this player. If the player has not sent a brand packet yet, it will return null.
    Returns:
      the brand of the client, or null if not received yet

  - ### clearDialog

    @Experimental void clearDialog()
    Clear the player's open dialog.
    Throws:
      `IllegalStateException` - if the players version is not at least 1.21.6

  - ### showDialog

    @Experimental void showDialog(Dialog dialog)
    Show a dialog to the player.
    Parameters:
      `dialog` - the dialog to show
    Throws:
      `IllegalStateException` - if the players version is not at least 1.21.6

  - ### sendServerLinks

    void sendServerLinks(List<ServerLink> serverLinks)
    Sends server links to the player. Note: The links already sent to the player will be overwritten. Also, the backend server is able to override links sent by the proxy.
    Parameters:
      `serverLinks` - the server links to send
    Throws:
      `IllegalStateException` - if the player's version is not at least 1.21