Contents
Class GenericPacketHandler
java.lang.Object
com.hypixel.hytale.server.core.io.PacketHandler
com.hypixel.hytale.server.core.io.handlers.GenericPacketHandler
- All Implemented Interfaces:
ConnectionHandler, IPacketReceiver
- Direct Known Subclasses:
AssetEditorPacketHandler, GamePacketHandler
- Since:
- 2021/03/29
-
Nested Class Summary
Nested classes/interfaces inherited from class PacketHandler
PacketHandler.DisconnectReason, PacketHandler.PingInfo -
Field Summary
Fields inherited from class PacketHandler
DEFAULT_STREAM_PRIORITIES, MAX_PACKET_ID -
Constructor Summary
ConstructorsConstructorDescriptionGenericPacketHandler(ChannelConnection channel, ProtocolVersion protocolVersion) Default Constructor for aGenericPacketHandlerinstance -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaccept(ToServerPacket packet) Called to accept the given incoming packet<T extends SubPacketHandler>
TgetSubPacketHandler(Class<T> type) booleanhandlesPacket(int packetId) Tests if this handler accepts packets with the given ID in its current state.static Consumer<ToServerPacket>[]newHandlerArray(int size) voidregisterHandler(int packetId, Consumer<ToServerPacket> handler) Register a new packet handlervoidregisterNoOpHandlers(int... packetIds) voidregisterSubPacketHandler(SubPacketHandler subPacketHandler) Methods inherited from class PacketHandler
checkStreamOpenRateLimit, closed, compareAndSetChannel, disconnect, disconnect, getAccountProfile, getAuth, getAuxiliaryChannelCount, getChannel, getChannel, getChannel, getClientReadyForChunksFuture, getDisconnectReason, getIdentifier, getOperationTimeoutThreshold, getPacketStatsRecorder, getPingInfo, getProtocolVersion, getQueuedPacketsCount, getSniHostname, handle, handlePong, isLANConnection, isLocalConnection, logCloseMessage, logConnectionTimings, registered, sendPing, setChannel, setChannel, setClientReadyForChunksFuture, setQueuePackets, stillActive, tickPing, tryFlush, unregistered, write, write, write, writeNoCache, writePacket
-
Constructor Details
-
GenericPacketHandler
public GenericPacketHandler(@Nonnull ChannelConnection channel, @Nonnull ProtocolVersion protocolVersion) Default Constructor for aGenericPacketHandlerinstance- Parameters:
channel- The channel affiliated with this packet handlerprotocolVersion- The network protocol version
-
-
Method Details
-
newHandlerArray
-
registerSubPacketHandler
-
getSubPacketHandler
-
registerHandler
Register a new packet handler- Parameters:
packetId- the packetIdhandler- the handler
-
registerNoOpHandlers
public void registerNoOpHandlers(@Nonnull int... packetIds) -
handlesPacket
public boolean handlesPacket(int packetId) Description copied from interface:ConnectionHandlerTests if this handler accepts packets with the given ID in its current state. Transports call this when the frame header arrives, before they buffer or decompress the payload, and close the connection if it returnsfalse.- Parameters:
packetId- The ID of the received packet
-
accept
Description copied from class:PacketHandlerCalled to accept the given incoming packet- Specified by:
acceptin classPacketHandler- Parameters:
packet- The packet instance to accept
-