public function putPacket(DataPacket $pk)
 {
     if (!$pk->isEncoded) {
         $pk->encode();
     }
     $this->client->pushMainToThreadPacket($pk->buffer);
 }
Ejemplo n.º 2
0
 public function broadcastPacket(array $players, DataPacket $packet, $direct = false)
 {
     $packet->encode();
     $pk = new BroadcastPacket();
     $pk->direct = $direct;
     $pk->payload = $packet->getBuffer();
     foreach ($players as $player) {
         $pk->entries[] = $player->getUniqueId();
     }
     $this->sendDataPacket($pk);
 }