mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
New TextPacket, first part
This commit is contained in:
parent
275a1e3f60
commit
2c59983672
@ -1,46 +0,0 @@
|
||||
<?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 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);
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,24 +24,28 @@ namespace pocketmine\network\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user