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.voiddisconnect(Text disconnectReason) Disconnects the player.default voidsendPacket(CustomPayload payload) Sends a packet.default voidsendPacket(CustomPayload payload, @Nullable PacketCallbacks callback) Sends a packet.default voidsendPacket(Packet<?> packet) Sends a packet.voidsendPacket(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
-