pocketmine\network\protocol\TextPacket::encode PHP Method

encode() public method

public encode ( )
    public function encode()
    {
        $this->reset();
        $this->putByte($this->type);
        switch ($this->type) {
            case self::TYPE_POPUP:
            case self::TYPE_CHAT:
                $this->putString($this->source);
            case self::TYPE_RAW:
            case self::TYPE_TIP:
            case self::TYPE_SYSTEM:
                $this->putString($this->message);
                break;
            case self::TYPE_TRANSLATION:
                $this->putString($this->message);
                $this->putByte(count($this->parameters));
                foreach ($this->parameters as $p) {
                    $this->putString($p);
                }
        }
    }