Package net.minestom.server.network
Record Class PacketParser
java.lang.Object
java.lang.Record
net.minestom.server.network.PacketParser
public record PacketParser(ClientPacketsHandler statusHandler, ClientPacketsHandler loginHandler, ClientPacketsHandler configurationHandler, ClientPacketsHandler playHandler)
extends Record
Responsible for parsing client packets.
You can retrieve the different packet handlers per state (status/login/play)
from the ClientPacketsHandler classes.
-
Constructor Summary
ConstructorsConstructorDescriptionPacketParser(ClientPacketsHandler statusHandler, ClientPacketsHandler loginHandler, ClientPacketsHandler configurationHandler, ClientPacketsHandler playHandler) Creates an instance of aPacketParserrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconfigurationHandlerrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theloginHandlerrecord component.@NotNull ClientPacketparse(@NotNull net.minestom.server.network.ConnectionState connectionState, int packetId, @NotNull ByteBuffer body) Returns the value of theplayHandlerrecord component.Returns the value of thestatusHandlerrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PacketParser
public PacketParser() -
PacketParser
public PacketParser(ClientPacketsHandler statusHandler, ClientPacketsHandler loginHandler, ClientPacketsHandler configurationHandler, ClientPacketsHandler playHandler) Creates an instance of aPacketParserrecord class.- Parameters:
statusHandler- the value for thestatusHandlerrecord componentloginHandler- the value for theloginHandlerrecord componentconfigurationHandler- the value for theconfigurationHandlerrecord componentplayHandler- the value for theplayHandlerrecord component
-
-
Method Details
-
parse
@NotNull public @NotNull ClientPacket parse(@NotNull @NotNull net.minestom.server.network.ConnectionState connectionState, int packetId, @NotNull @NotNull ByteBuffer body) -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
statusHandler
Returns the value of thestatusHandlerrecord component.- Returns:
- the value of the
statusHandlerrecord component
-
loginHandler
Returns the value of theloginHandlerrecord component.- Returns:
- the value of the
loginHandlerrecord component
-
configurationHandler
Returns the value of theconfigurationHandlerrecord component.- Returns:
- the value of the
configurationHandlerrecord component
-
playHandler
Returns the value of theplayHandlerrecord component.- Returns:
- the value of the
playHandlerrecord component
-