mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Updated for 1.2.0.22
This commit is contained in:
@ -51,12 +51,13 @@ class TextPacket extends DataPacket{
|
||||
public $message;
|
||||
/** @var string[] */
|
||||
public $parameters = [];
|
||||
/** @var string */
|
||||
public $xboxUserId = "";
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->type = $this->getByte();
|
||||
$this->needsTranslation = $this->getBool();
|
||||
switch($this->type){
|
||||
case self::TYPE_POPUP:
|
||||
case self::TYPE_CHAT:
|
||||
case self::TYPE_WHISPER:
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
@ -68,21 +69,24 @@ class TextPacket extends DataPacket{
|
||||
$this->message = $this->getString();
|
||||
break;
|
||||
|
||||
case self::TYPE_JUKEBOX_POPUP:
|
||||
case self::TYPE_TRANSLATION:
|
||||
case self::TYPE_POPUP:
|
||||
case self::TYPE_JUKEBOX_POPUP:
|
||||
$this->message = $this->getString();
|
||||
$count = $this->getUnsignedVarInt();
|
||||
for($i = 0; $i < $count; ++$i){
|
||||
$this->parameters[] = $this->getString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->xboxUserId = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putByte($this->type);
|
||||
$this->putBool($this->needsTranslation);
|
||||
switch($this->type){
|
||||
case self::TYPE_POPUP:
|
||||
case self::TYPE_CHAT:
|
||||
case self::TYPE_WHISPER:
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
@ -94,14 +98,18 @@ class TextPacket extends DataPacket{
|
||||
$this->putString($this->message);
|
||||
break;
|
||||
|
||||
case self::TYPE_JUKEBOX_POPUP:
|
||||
case self::TYPE_TRANSLATION:
|
||||
case self::TYPE_POPUP:
|
||||
case self::TYPE_JUKEBOX_POPUP:
|
||||
$this->putString($this->message);
|
||||
$this->putUnsignedVarInt(count($this->parameters));
|
||||
foreach($this->parameters as $p){
|
||||
$this->putString($p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->putString($this->xboxUserId);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
Reference in New Issue
Block a user