pocketmine\network\protocol\SetTimePacket::encode PHP Метод

encode() публичный Метод

public encode ( )
    public function encode()
    {
        $this->reset();
        $this->putInt($this->time);
        $this->putByte($this->started ? 1 : 0);
    }

Usage Example

Пример #1
0
 /**
  * Change the time of a player
  *
  * @param Player $player
  * @param $time
  * @param bool $static
  * @return bool
  */
 public function setPlayerTime(Player $player, $time, $static = false)
 {
     if (!is_int((int) $time) || !is_bool($static)) {
         return false;
     }
     $pk = new SetTimePacket();
     $pk->time = $time;
     $pk->started = $static === false;
     $pk->encode();
     $pk->isEncoded = true;
     $player->dataPacket($pk);
     if (isset($pk->__encapsulatedPacket)) {
         unset($pk->__encapsulatedPacket);
     }
     return true;
 }
SetTimePacket