PacketEvent<T>
Namespace Mc.Scripting · Kind class (sealed)
public sealed class PacketEvent<T> where T : PacketBaseOne packet handed to a handler. In intercept mode the handler may change PacketEvent.Packet and call PacketEvent.Cancel.
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Cancelled { get; } |
True once a handler cancelled the packet. |
T Packet { get; } |
The packet. |
Player Player { get; } |
The player the packet is from (serverbound) or to (clientbound). |
Cancelled
Section titled “Cancelled”public bool Cancelled { get; }True once a handler cancelled the packet.
Packet
Section titled “Packet”public T Packet { get; }The packet. Changing its fields changes what goes on (the engine validates the new values like any other).
Player
Section titled “Player”public Player Player { get; }The player the packet is from (serverbound) or to (clientbound).
Methods
Section titled “Methods”| Member | Description |
|---|---|
void Cancel() |
Stops the packet: a serverbound packet’s handler does not run, a clientbound packet is not sent. |
Cancel
Section titled “Cancel”public void Cancel()Stops the packet: a serverbound packet’s handler does not run, a clientbound packet is not sent. Only in intercept mode; an observer’s cancel is ignored.