endstone::PacketSendEvent
Called when the server sends a packet to a connected client.
Bases: endstone::Cancellable< ServerEvent >
Functions:
Name | Description |
---|---|
PacketSendEvent | |
getAddress | Gets the network address to which this packet is being sent. |
getPacketId | Gets the ID of the packet. |
getPayload | Gets the raw packet data excluding the header. |
getPlayer | Returns the player involved in this event. |
getSubClientId | Gets the SubClient ID. |
setPayload | Sets the raw packet data excluding the header. |
PacketSendEvent
PacketSendEvent(Player *player, const int packet_id, std::string_view payload,
SocketAddress address, const int sub_client_id)
getAddress
SocketAddress getAddress() const
Gets the network address to which this packet is being sent.
Returns:
The SocketAddress of the destination client.
getPacketId
int getPacketId() const
Gets the ID of the packet.
Returns:
The packet ID.
getPayload
std::string_view getPayload() const
Gets the raw packet data excluding the header.
Returns:
The packet payload data.
getPlayer
Player *getPlayer() const
Returns the player involved in this event.
Note:
This may return nullptr if the packet is sent before the player completes the login process.
Returns:
Player who is involved in this event
getSubClientId
int getSubClientId() const
Gets the SubClient ID.
Note:
Range is 0 to 3 (0 = primary client; 1-3 = split-screen clients).
Returns:
The SubClient ID.
setPayload
void setPayload(std::string_view payload)
Sets the raw packet data excluding the header.
Returns:
The packet payload data.
Last updated on