Merge branch 'minor-next' into major-next

This commit is contained in:
Dylan K. Taylor
2023-04-05 20:14:59 +01:00
9 changed files with 69 additions and 49 deletions

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe;
use pocketmine\event\server\DataPacketSendEvent;
use pocketmine\network\mcpe\protocol\serializer\PacketBatch;
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
@ -41,6 +42,15 @@ final class StandardPacketBroadcaster implements PacketBroadcaster{
){}
public function broadcastPackets(array $recipients, array $packets) : void{
//TODO: this shouldn't really be called here, since the broadcaster might be replaced by an alternative
//implementation that doesn't fire events
$ev = new DataPacketSendEvent($recipients, $packets);
$ev->call();
if($ev->isCancelled()){
return;
}
$packets = $ev->getPackets();
$compressors = [];
/** @var NetworkSession[][] $targetsByCompressor */