public class GlowSession
extends com.flowpowered.network.session.BasicSession
Constructor and Description |
---|
GlowSession(GlowServer server,
ProtocolProvider protocolProvider,
io.netty.channel.Channel channel,
com.flowpowered.network.ConnectionManager connectionManager)
Creates a new session.
|
Modifier and Type | Method and Description |
---|---|
void |
disconnect()
Deprecated.
|
void |
disconnect(String reason)
Disconnects the session with the specified reason.
|
void |
disconnect(String reason,
boolean overrideKick)
Disconnects the session with the specified reason.
|
void |
enableCompression(int threshold)
Enables compression if not already enabled.
|
void |
enableEncryption(SecretKey sharedSecret)
Enables encryption or changes the session key.
|
InetSocketAddress |
getAddress()
The remote address of the connection.
|
GlowPlayer |
getPlayer()
The player associated with this session (if there is one).
|
ProxyData |
getProxyData()
Data regarding a user who has connected through a proxy, used to provide online-mode UUID and
properties and other data even if the server is running in offline mode.
|
GlowServer |
getServer()
The server this session belongs to.
|
byte[] |
getVerifyToken()
The randomly-generated verify token used in authentication for this session.
|
String |
getVerifyUsername()
The verify username used in authentication.
|
int |
getVersion()
The version used to connect.
|
InetSocketAddress |
getVirtualHost()
The hostname/port the player used to connect to the server.
|
void |
idle()
Notify that the session is currently idle.
|
boolean |
isOnline()
The state of the connection.
|
void |
messageReceived(com.flowpowered.network.Message message) |
void |
onDisconnect() |
void |
onHandlerThrowable(com.flowpowered.network.Message message,
com.flowpowered.network.MessageHandler<?,?> handle,
Throwable t) |
void |
onInboundThrowable(Throwable t) |
void |
onOutboundThrowable(Throwable t) |
void |
pong(long pingId)
Note that the client has responded to a keep-alive.
|
void |
sendAndRelease(com.flowpowered.network.Message message,
io.netty.buffer.ByteBuf... bufs)
Send the message and release the specified byte buffers after it is sent.
|
void |
sendAndRelease(com.flowpowered.network.Message message,
io.netty.buffer.ByteBuf buf)
Send the message and release the specified byte buffer after it is sent.
|
io.netty.channel.ChannelFuture |
sendWithFuture(com.flowpowered.network.Message message) |
void |
setPlayer(GlowPlayerProfile profile)
Sets the player associated with this session.
|
void |
setProtocol(com.flowpowered.network.protocol.AbstractProtocol proto)
Sets the protocol for this session.
|
void |
setProxyData(ProxyData proxyData)
Set the
ProxyData for this session. |
void |
setVerifyToken(byte[] verifyToken)
The randomly-generated verify token used in authentication for this session.
|
void |
setVerifyUsername(String verifyUsername)
The verify username used in authentication.
|
void |
setVersion(int version)
Sets the version.
|
void |
setVirtualHost(InetSocketAddress virtualHost)
The hostname/port the player used to connect to the server.
|
String |
toString() |
public GlowSession(GlowServer server, ProtocolProvider protocolProvider, io.netty.channel.Channel channel, com.flowpowered.network.ConnectionManager connectionManager)
server
- The server this session belongs to.channel
- The channel associated with this session.connectionManager
- The connection manager to manage connections for this
session.public void setProxyData(ProxyData proxyData)
ProxyData
for this session.proxyData
- The proxy data to use.public void setVersion(int version)
version
- the versionIllegalStateException
- if the version has already been setpublic void idle()
public void pong(long pingId)
pingId
- The pingId to check for validity.public void setPlayer(GlowPlayerProfile profile)
profile
- The player's profile with name and UUID information.IllegalStateException
- if there is already a player associated with this
session.public io.netty.channel.ChannelFuture sendWithFuture(com.flowpowered.network.Message message)
sendWithFuture
in class com.flowpowered.network.session.BasicSession
public void sendAndRelease(com.flowpowered.network.Message message, io.netty.buffer.ByteBuf buf)
message
- The message.buf
- The byte buffer.public void sendAndRelease(com.flowpowered.network.Message message, io.netty.buffer.ByteBuf... bufs)
message
- The message.bufs
- The byte buffers.@Deprecated public void disconnect()
disconnect
in interface com.flowpowered.network.session.Session
disconnect
in class com.flowpowered.network.session.BasicSession
public void disconnect(String reason)
This causes a KickMessage to be sent. When it has been delivered, the channel is closed.
reason
- The reason for disconnection.public void disconnect(String reason, boolean overrideKick)
This causes a KickMessage to be sent. When it has been delivered, the channel is closed.
reason
- The reason for disconnection.overrideKick
- Whether to skip the kick event.public void setProtocol(com.flowpowered.network.protocol.AbstractProtocol proto)
setProtocol
in class com.flowpowered.network.session.BasicSession
proto
- the new protocolpublic void enableEncryption(SecretKey sharedSecret)
sharedSecret
- the new session keypublic void enableCompression(int threshold)
threshold
- the minimum message size in bytes to compresspublic void onDisconnect()
onDisconnect
in interface com.flowpowered.network.session.Session
onDisconnect
in class com.flowpowered.network.session.BasicSession
public void messageReceived(com.flowpowered.network.Message message)
messageReceived
in interface com.flowpowered.network.session.Session
messageReceived
in class com.flowpowered.network.session.BasicSession
public void onInboundThrowable(Throwable t)
onInboundThrowable
in interface com.flowpowered.network.session.Session
onInboundThrowable
in class com.flowpowered.network.session.BasicSession
public void onOutboundThrowable(Throwable t)
onOutboundThrowable
in class com.flowpowered.network.session.BasicSession
public void onHandlerThrowable(com.flowpowered.network.Message message, com.flowpowered.network.MessageHandler<?,?> handle, Throwable t)
onHandlerThrowable
in class com.flowpowered.network.session.BasicSession
public String toString()
toString
in class com.flowpowered.network.session.BasicSession
public GlowServer getServer()
public InetSocketAddress getAddress()
getAddress
in class com.flowpowered.network.session.BasicSession
public boolean isOnline()
public byte[] getVerifyToken()
public void setVerifyToken(byte[] verifyToken)
verifyToken
- the verify tokenpublic String getVerifyUsername()
public void setVerifyUsername(String verifyUsername)
public InetSocketAddress getVirtualHost()
public void setVirtualHost(InetSocketAddress virtualHost)
public int getVersion()
public ProxyData getProxyData()
Null for non-proxied sessions.
public GlowPlayer getPlayer()
null
if no player is associated with this session.Copyright © 2021. All rights reserved.