Package net.minestom.server.network
Record Class PacketProcessor
java.lang.Object
java.lang.Record
net.minestom.server.network.PacketProcessor
public record PacketProcessor(@NotNull ClientPacketsHandler statusHandler, @NotNull ClientPacketsHandler loginHandler, @NotNull ClientPacketsHandler playHandler)
extends Record
Responsible for processing client packets.
You can retrieve the different packet handlers per state (status/login/play)
from the ClientPacketsHandler
classes.
-
Constructor Summary
ConstructorDescriptionPacketProcessor
(@NotNull ClientPacketsHandler statusHandler, @NotNull ClientPacketsHandler loginHandler, @NotNull ClientPacketsHandler playHandler) Creates an instance of aPacketProcessor
record class. -
Method Summary
Modifier and TypeMethodDescription@NotNull ClientPacket
create
(@NotNull ConnectionState connectionState, int packetId, ByteBuffer body) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@NotNull ClientPacketsHandler
Returns the value of theloginHandler
record component.@NotNull ClientPacketsHandler
Returns the value of theplayHandler
record component.process
(@NotNull PlayerConnection connection, int packetId, ByteBuffer body) @NotNull ClientPacketsHandler
Returns the value of thestatusHandler
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
PacketProcessor
public PacketProcessor() -
PacketProcessor
public PacketProcessor(@NotNull @NotNull ClientPacketsHandler statusHandler, @NotNull @NotNull ClientPacketsHandler loginHandler, @NotNull @NotNull ClientPacketsHandler playHandler) Creates an instance of aPacketProcessor
record class.- Parameters:
statusHandler
- the value for thestatusHandler
record componentloginHandler
- the value for theloginHandler
record componentplayHandler
- the value for theplayHandler
record component
-
-
Method Details
-
create
@NotNull public @NotNull ClientPacket create(@NotNull @NotNull ConnectionState connectionState, int packetId, ByteBuffer body) -
process
public ClientPacket process(@NotNull @NotNull PlayerConnection connection, int packetId, 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 thestatusHandler
record component.- Returns:
- the value of the
statusHandler
record component
-
loginHandler
Returns the value of theloginHandler
record component.- Returns:
- the value of the
loginHandler
record component
-
playHandler
Returns the value of theplayHandler
record component.- Returns:
- the value of the
playHandler
record component
-