Interface PlayerConnection
- All Known Subinterfaces:
PlayerCommonConnection, PlayerConfigurationConnection, PlayerGameConnection, PlayerLoginConnection, ReadablePlayerCookieConnection, WritablePlayerCookieConnection
public interface PlayerConnection
- Since:
- 1.21.7
-
Method Summary
Modifier and TypeMethodDescriptionvoiddisconnect(net.kyori.adventure.text.Component component) Disconnects the player connection.Gets the raw remote address of the connection.Gets the real client address of the player.@Nullable InetSocketAddressGets the socket address of this player's proxy@Nullable InetSocketAddressReturns the virtual host the client is connected to.booleanReturns whether this connection is currently open and active.booleanGets if this connection originated from a transferred connection.
-
Method Details
-
disconnect
void disconnect(net.kyori.adventure.text.Component component) Disconnects the player connection.Note that calling this during connection related events may cause undefined behavior.
- Parameters:
component- disconnect reason- Since:
- 1.21.7
-
isConnected
boolean isConnected()Returns whether this connection is currently open and active.- Returns:
- whether this connection is currently open and active
- Since:
- 1.21.10
-
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
- Since:
- 1.21.7
-
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
SocketAddressof the channel - Since:
- 1.21.7
-
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 - Since:
- 1.21.7
-
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
nullif unknown - Since:
- 1.21.7
-
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
- Since:
- 1.21.7
-