diff --git a/src/pocketmine/network/protocol/ChatPacket.php b/src/pocketmine/network/protocol/ChatPacket.php deleted file mode 100644 index d1ba748d5..000000000 --- a/src/pocketmine/network/protocol/ChatPacket.php +++ /dev/null @@ -1,46 +0,0 @@ - - - -class ChatPacket extends DataPacket{ - public static $pool = []; - public static $next = 0; - - public $message; - - public function pid(){ - return Info::CHAT_PACKET; - } - - public function decode(){ - - } - - public function encode(){ - $this->reset(); - $this->putString($this->message); - } - -} \ No newline at end of file diff --git a/src/pocketmine/network/protocol/Info.php b/src/pocketmine/network/protocol/Info.php index 7c14adef4..a6ec22b2f 100644 --- a/src/pocketmine/network/protocol/Info.php +++ b/src/pocketmine/network/protocol/Info.php @@ -37,7 +37,7 @@ interface Info{ const DISCONNECT_PACKET = 0x84; - const MESSAGE_PACKET = 0x85; + const TEXT_PACKET = 0x85; const SET_TIME_PACKET = 0x86; const START_GAME_PACKET = 0x87; @@ -87,11 +87,10 @@ interface Info{ const CONTAINER_SET_DATA_PACKET = 0xab; const CONTAINER_SET_CONTENT_PACKET = 0xac; //const CONTAINER_ACK_PACKET = 0xad; - const CHAT_PACKET = 0xae; - const ADVENTURE_SETTINGS_PACKET = 0xaf; - const TILE_ENTITY_DATA_PACKET = 0xb0; - //const PLAYER_INPUT_PACKET = 0xb1; - const FULL_CHUNK_DATA_PACKET = 0xb2; - const SET_DIFFICULTY_PACKET = 0xb3; + const ADVENTURE_SETTINGS_PACKET = 0xae; + const TILE_ENTITY_DATA_PACKET = 0xaf; + //const PLAYER_INPUT_PACKET = 0xb0; + const FULL_CHUNK_DATA_PACKET = 0xb1; + const SET_DIFFICULTY_PACKET = 0xb2; } diff --git a/src/pocketmine/network/protocol/PlayerActionPacket.php b/src/pocketmine/network/protocol/PlayerActionPacket.php index 285659ea6..caac04fe7 100644 --- a/src/pocketmine/network/protocol/PlayerActionPacket.php +++ b/src/pocketmine/network/protocol/PlayerActionPacket.php @@ -28,28 +28,33 @@ class PlayerActionPacket extends DataPacket{ public static $pool = []; public static $next = 0; + public $eid; public $action; public $x; public $y; public $z; public $face; - public $eid; public function pid(){ return Info::PLAYER_ACTION_PACKET; } public function decode(){ + $this->eid = $this->getLong(); $this->action = $this->getInt(); $this->x = $this->getInt(); $this->y = $this->getInt(); $this->z = $this->getInt(); $this->face = $this->getInt(); - $this->eid = $this->getLong(); } public function encode(){ - + $this->putLong($this->eid); + $this->putInt($this->action); + $this->putInt($this->x); + $this->putInt($this->y); + $this->putInt($this->z); + $this->putInt($this->face); } } diff --git a/src/pocketmine/network/protocol/MessagePacket.php b/src/pocketmine/network/protocol/TextPacket.php similarity index 86% rename from src/pocketmine/network/protocol/MessagePacket.php rename to src/pocketmine/network/protocol/TextPacket.php index 6704adadb..f55ed4d89 100644 --- a/src/pocketmine/network/protocol/MessagePacket.php +++ b/src/pocketmine/network/protocol/TextPacket.php @@ -24,26 +24,30 @@ namespace pocketmine\network\protocol; #include -class MessagePacket extends DataPacket{ +class TextPacket extends DataPacket{ public static $pool = []; public static $next = 0; + public $type; public $source; public $message; + public $parameters = []; public function pid(){ - return Info::MESSAGE_PACKET; + 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); } -} \ No newline at end of file +}