PocketMine-MP 5.16.1 git-585aee9386a787c95e73dd0a05ffca8329606b68
pocketmine\event\server\DataPacketSendEvent Class Reference
+ Inheritance diagram for pocketmine\event\server\DataPacketSendEvent:
+ Collaboration diagram for pocketmine\event\server\DataPacketSendEvent:

Public Member Functions

 __construct (private array $targets, private array $packets)
 
 call ()
 
 getEventName ()
 
 getPackets ()
 
 getTargets ()
 
 isCancelled ()
 
 setPackets (array $packets)
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

string $eventName = null
 

Detailed Description

Called when packets are sent to network sessions.

Definition at line 35 of file DataPacketSendEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\server\DataPacketSendEvent::__construct ( private array  $targets,
private array  $packets 
)
Parameters
NetworkSession[]$targets
ClientboundPacket[]$packets

Definition at line 42 of file DataPacketSendEvent.php.

Member Function Documentation

◆ call()

pocketmine\event\Event::call ( )
inherited

Calls event handlers registered for this event.

Exceptions

RuntimeException if event call recursion reaches the max depth limit

Definition at line 49 of file Event.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getPackets()

pocketmine\event\server\DataPacketSendEvent::getPackets ( )
Returns
ClientboundPacket[]

Definition at line 57 of file DataPacketSendEvent.php.

◆ getTargets()

pocketmine\event\server\DataPacketSendEvent::getTargets ( )
Returns
NetworkSession[]

Definition at line 50 of file DataPacketSendEvent.php.

◆ hasHandlers()

static pocketmine\event\Event::hasHandlers ( )
staticinherited

Returns whether the current class context has any registered global handlers. This can be used in hot code paths to avoid unnecessary event object creation.

Usage: SomeEventClass::hasHandlers()

Definition at line 77 of file Event.php.

◆ isCancelled()

pocketmine\event\Cancellable::isCancelled ( )
inherited

Returns whether this instance of the event is currently cancelled.

If it is cancelled, only downstream handlers that declare @handleCancelled will be called with this event.

◆ setPackets()

pocketmine\event\server\DataPacketSendEvent::setPackets ( array  $packets)
Parameters
ClientboundPacket[]$packets

Definition at line 64 of file DataPacketSendEvent.php.

Member Data Documentation

◆ $eventName

string pocketmine\event\Event::$eventName = null
protectedinherited

Definition at line 38 of file Event.php.


The documentation for this class was generated from the following file: