Package net.md_5.bungee.api.connection

# Interface PendingConnection

All Superinterfaces:
  `Connection`

public interface PendingConnection extends Connection
Represents a user attempting to log into the proxy.

- ## Nested Class Summary

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

  `Connection.Unsafe`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ListenerInfo`
  `getListener()`
  Get the listener that accepted this connection.
  `String`
  `getName()`
  Get the requested username.
  `UUID`
  `getUniqueId()`
  Get this connection's UUID, if set.
  `String`
  `getUUID()`
  Deprecated.
  In favour of `getUniqueId()`
  `int`
  `getVersion()`
  Get the numerical client version of the player attempting to log in.
  `InetSocketAddress`
  `getVirtualHost()`
  Get the requested virtual host that the client tried to connect to.
  `boolean`
  `isLegacy()`
  Check if the client is using the older unsupported Minecraft protocol used by Minecraft clients older than 1.7.
  `boolean`
  `isOnlineMode()`
  Get this connection's online mode.
  `boolean`
  `isTransferred()`
  Gets if this connection has been transferred from another server.
  `CompletableFuture<byte[]>`
  `retrieveCookie(String cookie)`
  Retrieves a cookie from this pending connection.
  `CompletableFuture<byte[]>`
  `sendData(String channel, byte[] data)`
  Sends a login payload request to the client.
  `void`
  `setOnlineMode(boolean onlineMode)`
  Set this connection's online mode.
  `void`
  `setUniqueId(UUID uuid)`
  Set the connection's uuid

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

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

- ## Method Details

  - ### getName

    String getName()
    Get the requested username.
    Returns:
      the requested username, or null if not set

  - ### getVersion

    int getVersion()
    Get the numerical client version of the player attempting to log in.
    Returns:
      the protocol version of the remote client

  - ### getVirtualHost

    InetSocketAddress getVirtualHost()
    Get the requested virtual host that the client tried to connect to.
    Returns:
      request virtual host or null if invalid / not specified.

  - ### getListener

    ListenerInfo getListener()
    Get the listener that accepted this connection.
    Returns:
      the accepting listener

  - ### 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

  - ### setUniqueId

    void setUniqueId(UUID uuid)
    Set the connection's uuid
    Parameters:
      `uuid` - connection UUID

  - ### isOnlineMode

    boolean isOnlineMode()
    Get this connection's online mode.
    See `setOnlineMode(boolean)` for a description of how this option works.
    Returns:
      the online mode

  - ### setOnlineMode

    void setOnlineMode(boolean onlineMode)
    Set this connection's online mode.
    May be called only during the PlayerHandshakeEvent to set the online mode configuration setting for this connection only (i.e. whether or not the client will be treated as if it is connecting to an online mode server).
    Parameters:
      `onlineMode` - status

  - ### isLegacy

    boolean isLegacy()
    Check if the client is using the older unsupported Minecraft protocol used by Minecraft clients older than 1.7.
    Returns:
      Whether the client is using a legacy client.

  - ### isTransferred

    boolean isTransferred()
    Gets if this connection has been transferred from another server.
    Returns:
      true if the connection has been transferred

  - ### retrieveCookie

    CompletableFuture<byte[]> retrieveCookie(String cookie)
    Retrieves a cookie from this pending connection.
    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

  - ### sendData

    CompletableFuture<byte[]> sendData(String channel, byte[] data)
    Sends a login payload request to the client.
    Parameters:
      `channel` - the channel to send this data via
      `data` - the data to send
    Returns:
      a `CompletableFuture` that will be completed when the Login Payload response is received. If the Vanilla client doesn't know the channel, the `CompletableFuture` will complete with a null value
    Throws:
      `IllegalStateException` - if the player's version is not at least 1.13