getPacket() public method

public getPacket ( $id ) : DataPacket
$id
return pocketmine\network\protocol\DataPacket
Example #1
0
 private function getPacket($buffer)
 {
     $pid = ord($buffer[0]);
     if (($data = $this->network->getPacket($pid)) === null) {
         return null;
     }
     $data->setBuffer($buffer, 1);
     return $data;
 }
 private function getPacket($buffer)
 {
     $pid = \ord($buffer[0]);
     if (($data = $this->network->getPacket($pid)) === \null) {
         $data = new UnknownPacket();
         $data->packetID = $pid;
     }
     $data->setBuffer($buffer, 1);
     return $data;
 }
Example #3
0
 private function getPacket($buffer)
 {
     $pid = ord($buffer[1]);
     // #blameshoghi
     if (($data = $this->network->getPacket($pid)) === null) {
         return null;
     }
     $data->setBuffer($buffer, 2);
     // #blameshoghi
     return $data;
 }
 private function getPacket($buffer)
 {
     //@todo backwart compatible - on 0.13 was
     //$pid = ord($buffer{0});
     $pid = ord($buffer[1]);
     if (($data = $this->network->getPacket($pid)) === null) {
         return null;
     }
     //@todo backwart compatible - on 0.13 was
     //$data->setBuffer($buffer, 1);
     $data->setBuffer($buffer, 2);
     return $data;
 }
 private function getPacket($buffer)
 {
     $pid = ord($buffer[0]);
     $start = 1;
     if ($pid == 0xfe) {
         $pid = ord($buffer[1]);
         $start++;
     }
     if (($data = $this->network->getPacket($pid)) === null) {
         return null;
     }
     $data->setBuffer($buffer, $start);
     return $data;
 }