public class BedrockPeer
extends io.netty.channel.ChannelInboundHandlerAdapter
BedrockSessions.| Modifier and Type | Field and Description |
|---|---|
protected io.netty.channel.Channel |
channel |
protected java.util.concurrent.atomic.AtomicBoolean |
closed |
static java.lang.String |
NAME |
protected java.util.Queue<BedrockPacketWrapper> |
packetQueue |
protected BedrockSessionFactory |
sessionFactory |
protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<BedrockSession> |
sessions |
protected io.netty.util.concurrent.ScheduledFuture<?> |
tickFuture |
| Constructor and Description |
|---|
BedrockPeer(io.netty.channel.Channel channel,
BedrockSessionFactory sessionFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRead(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Object msg) |
protected void |
checkForClosed() |
void |
close(java.lang.String reason) |
void |
enableEncryption(@NonNull javax.crypto.SecretKey secretKey) |
io.netty.channel.Channel |
getChannel() |
org.cloudburstmc.protocol.bedrock.codec.BedrockCodec |
getCodec() |
org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper |
getCodecHelper() |
org.cloudburstmc.protocol.bedrock.data.PacketCompressionAlgorithm |
getCompression() |
java.net.SocketAddress |
getSocketAddress() |
void |
handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) |
boolean |
isConnected() |
boolean |
isConnecting() |
protected void |
onBedrockPacket(BedrockPacketWrapper wrapper) |
protected void |
onClose() |
protected BedrockSession |
onSessionCreated(int sessionId) |
protected void |
onTick() |
protected void |
removeSession(BedrockSession session) |
void |
sendPacket(int senderClientId,
int targetClientId,
org.cloudburstmc.protocol.bedrock.packet.BedrockPacket packet) |
void |
sendPacketImmediately(int senderClientId,
int targetClientId,
org.cloudburstmc.protocol.bedrock.packet.BedrockPacket packet) |
void |
setCodec(org.cloudburstmc.protocol.bedrock.codec.BedrockCodec codec) |
void |
setCompression(org.cloudburstmc.protocol.bedrock.data.PacketCompressionAlgorithm algorithm) |
void |
setCompressionLevel(int level) |
void |
userEventTriggered(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Object evt) |
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtensureNotSharable, handlerAdded, isSharablepublic static final java.lang.String NAME
protected final it.unimi.dsi.fastutil.ints.Int2ObjectMap<BedrockSession> sessions
protected final java.util.Queue<BedrockPacketWrapper> packetQueue
protected final io.netty.channel.Channel channel
protected final BedrockSessionFactory sessionFactory
protected io.netty.util.concurrent.ScheduledFuture<?> tickFuture
protected java.util.concurrent.atomic.AtomicBoolean closed
public BedrockPeer(io.netty.channel.Channel channel,
BedrockSessionFactory sessionFactory)
protected void onBedrockPacket(BedrockPacketWrapper wrapper)
protected BedrockSession onSessionCreated(int sessionId)
protected void checkForClosed()
protected void removeSession(BedrockSession session)
protected void onTick()
public void sendPacket(int senderClientId,
int targetClientId,
org.cloudburstmc.protocol.bedrock.packet.BedrockPacket packet)
public void sendPacketImmediately(int senderClientId,
int targetClientId,
org.cloudburstmc.protocol.bedrock.packet.BedrockPacket packet)
public void enableEncryption(@NonNull javax.crypto.SecretKey secretKey)
public void setCompression(org.cloudburstmc.protocol.bedrock.data.PacketCompressionAlgorithm algorithm)
public void setCompressionLevel(int level)
public org.cloudburstmc.protocol.bedrock.data.PacketCompressionAlgorithm getCompression()
public org.cloudburstmc.protocol.bedrock.codec.BedrockCodec getCodec()
public org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper getCodecHelper()
public void setCodec(org.cloudburstmc.protocol.bedrock.codec.BedrockCodec codec)
public void close(java.lang.String reason)
protected void onClose()
public boolean isConnected()
public boolean isConnecting()
public java.net.SocketAddress getSocketAddress()
public io.netty.channel.Channel getChannel()
public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
handlerRemoved in interface io.netty.channel.ChannelHandlerhandlerRemoved in class io.netty.channel.ChannelHandlerAdapterpublic void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws java.lang.Exception
channelActive in interface io.netty.channel.ChannelInboundHandlerchannelActive in class io.netty.channel.ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
throws java.lang.Exception
channelInactive in interface io.netty.channel.ChannelInboundHandlerchannelInactive in class io.netty.channel.ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void channelRead(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Object msg)
throws java.lang.Exception
channelRead in interface io.netty.channel.ChannelInboundHandlerchannelRead in class io.netty.channel.ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Object evt)
throws java.lang.Exception
userEventTriggered in interface io.netty.channel.ChannelInboundHandleruserEventTriggered in class io.netty.channel.ChannelInboundHandlerAdapterjava.lang.Exception