Class PacketBlocker
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.geysermc.floodgate.core.addon.data.PacketBlocker
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class PacketBlocker
extends io.netty.channel.ChannelInboundHandlerAdapter
In Floodgate the PacketBlocker is used to temporarily prevent packets from being decoded. A
similar system is used to prevent packets from being handled while Floodgate is processing the
login. The old system blocked the thread which was processing the Floodgate login, but that
doesn't only block the packets for that specific user, it's shared between multiple users causing
them to lag or sometimes timeout.
The reason why we prevent packets from being handled is because keeping the packet order is important. That is also the reason why we prevent packets from being decoded during that time. The 'login start' packet for example can only be decoded after the handshake packet has been handled, because the server can only successfully decode the packet after the handshake packet caused the server to switch to the login state.
The reason why we prevent packets from being handled is because keeping the packet order is important. That is also the reason why we prevent packets from being decoded during that time. The 'login start' packet for example can only be decoded after the handshake packet has been handled, because the server can only successfully decode the packet after the handshake packet caused the server to switch to the login state.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) voiddisable()voidenable()booleanenabled()voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx) Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerRemoved
-
Constructor Details
-
PacketBlocker
public PacketBlocker()
-
-
Method Details
-
enable
public void enable() -
disable
public void disable() -
enabled
public boolean enabled() -
channelRead
- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.channel.ChannelHandlerAdapter
-