API reference Obsidian.API.Events
PacketReceivedEventArgs class
public sealed class PacketReceivedEventArgs : PlayerEventArgs, ICancellable
In Obsidian.API.
Constructors
PacketReceivedEventArgs(IPlayer, IServer, int, ReadOnlyMemory<byte>)
public PacketReceivedEventArgs(IPlayer player, IServer server, int id, ReadOnlyMemory<byte> data);Initializes a new instance of the PacketReceivedEventArgs class with PlayerEventArgs.Player, PacketReceivedEventArgs.Id and PacketReceivedEventArgs.Data properties set to the given values.
Parameters
player- The player involved in this event.
id- Id of the received packet.
data- Packet data, excluding packet id and packet length.
server- The server this took place in.
Properties
Data
public ReadOnlyMemory<byte> Data { get; }Packet data, excluding packet id and packet length.
Id
public int Id { get; }Id of the received packet.
IsCancelled
public bool IsCancelled { get; }Gets a value indicating whether the default behaviour should be cancelled.
Methods
Cancel()
public void Cancel();Sets a flag which prevents default (vanilla) behavior from executing.
Remarks
This flag only affects vanilla behavior. If you wish to prevent other handlers from running, see AsyncEventArgs.Handled.