Interface PacketSender
- All Known Subinterfaces:
LoginPacketSender
@NonExtendable
public interface PacketSender
Represents something that supports sending packets to channels.
Any packets sent must be registered in the appropriate registry.
-
Method Summary
Modifier and TypeMethodDescriptionPacket
<?> createPacket
(CustomPayload payload) Creates a packet from a packet payload.void
disconnect
(Text disconnectReason) Disconnects the player.default void
sendPacket
(CustomPayload payload) Sends a packet.default void
sendPacket
(CustomPayload payload, @Nullable PacketCallbacks callback) Sends a packet.default void
sendPacket
(Packet<?> packet) Sends a packet.void
sendPacket
(Packet<?> packet, @Nullable PacketCallbacks callback) Sends a packet.
-
Method Details
-
createPacket
Creates a packet from a packet payload.- Parameters:
payload
- the packet payload
-
sendPacket
Sends a packet.- Parameters:
packet
- the packet
-
sendPacket
Sends a packet.- Parameters:
payload
- the payload
-
sendPacket
Sends a packet.- Parameters:
packet
- the packetcallback
- an optional callback to execute after the packet is sent, may benull
.
-
sendPacket
Sends a packet.- Parameters:
payload
- the payloadcallback
- an optional callback to execute after the packet is sent, may benull
.
-
disconnect
Disconnects the player.- Parameters:
disconnectReason
- the reason for disconnection
-