New TextPacket, first part

This commit is contained in:
Shoghi Cervantes
2015-03-19 18:48:03 +01:00
parent 275a1e3f60
commit 2c59983672
4 changed files with 21 additions and 59 deletions

View File

@ -0,0 +1,53 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
class TextPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
public $type;
public $source;
public $message;
public $parameters = [];
public function pid(){
return Info::TEXT_PACKET;
}
public function decode(){
$this->type = $this->getByte();
$this->source = $this->getString();
$this->message = $this->getString();
}
public function encode(){
$this->reset();
$this->putByte($this->type);
$this->putString($this->source);
$this->putString($this->message);
}
}