Package io.papermc.paper.connection
Interface PlayerConnection
- All Known Subinterfaces:
PlayerCommonConnection
,PlayerConfigurationConnection
,PlayerGameConnection
,PlayerLoginConnection
,ReadablePlayerCookieConnection
,WritablePlayerCookieConnection
public interface PlayerConnection
-
Method Summary
Modifier and TypeMethodDescriptionvoid
disconnect
(Component component) Disconnects the player connection.Gets the raw remote address of the connection.Gets the real client address of the player.Gets the socket address of this player's proxyReturns the virtual host the client is connected to.boolean
Gets if this connection originated from a transferred connection.
-
Method Details
-
disconnect
Disconnects the player connection.Note that calling this during connection related events may caused undefined behavior.
- Parameters:
component
- disconnect reason
-
isTransferred
boolean isTransferred()Gets if this connection originated from a transferred connection.Do note that this is sent and stored on the client.
- Returns:
- is transferred
-
getAddress
SocketAddress getAddress()Gets the raw remote address of the connection. This may be a proxy address or a Unix domain socket address, depending on how the channel was established.- Returns:
- the remote
SocketAddress
of the channel
-
getClientAddress
InetSocketAddress getClientAddress()Gets the real client address of the player. If the connection is behind a proxy, this will be the actual player’s IP address extracted from the proxy handshake.- Returns:
- the client
InetSocketAddress
-
getVirtualHost
@Nullable InetSocketAddress getVirtualHost()Returns the virtual host the client is connected to.The virtual host refers to the hostname/port the client used to connect to the server.
- Returns:
- The client's virtual host, or
null
if unknown
-
getHAProxyAddress
@Nullable InetSocketAddress getHAProxyAddress()Gets the socket address of this player's proxy- Returns:
- the player's proxy address, null if the server doesn't have Proxy Protocol enabled, or the player didn't connect to an HAProxy instance
-