mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
DataPacketSendEvent: add array type validation
this API is used directly by plugins, so anything goes.
This commit is contained in:
parent
774df0fa4c
commit
e1b0e00c6f
@ -27,6 +27,7 @@ use pocketmine\event\Cancellable;
|
|||||||
use pocketmine\event\CancellableTrait;
|
use pocketmine\event\CancellableTrait;
|
||||||
use pocketmine\network\mcpe\NetworkSession;
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
||||||
|
use pocketmine\utils\Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when packets are sent to network sessions.
|
* Called when packets are sent to network sessions.
|
||||||
@ -61,6 +62,7 @@ class DataPacketSendEvent extends ServerEvent implements Cancellable{
|
|||||||
* @param ClientboundPacket[] $packets
|
* @param ClientboundPacket[] $packets
|
||||||
*/
|
*/
|
||||||
public function setPackets(array $packets) : void{
|
public function setPackets(array $packets) : void{
|
||||||
|
Utils::validateArrayValueType($packets, function(ClientboundPacket $_) : void{});
|
||||||
$this->packets = $packets;
|
$this->packets = $packets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user