DataPacketSendEvent: add array type validation

this API is used directly by plugins, so anything goes.
This commit is contained in:
Dylan K. Taylor 2022-10-13 17:10:33 +01:00
parent 774df0fa4c
commit e1b0e00c6f
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -27,6 +27,7 @@ use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\ClientboundPacket;
use pocketmine\utils\Utils;
/**
* Called when packets are sent to network sessions.
@ -61,6 +62,7 @@ class DataPacketSendEvent extends ServerEvent implements Cancellable{
* @param ClientboundPacket[] $packets
*/
public function setPackets(array $packets) : void{
Utils::validateArrayValueType($packets, function(ClientboundPacket $_) : void{});
$this->packets = $packets;
}
}