mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-28 05:35:40 +00:00
Updated for 1.2.0.22
This commit is contained in:
parent
121777375e
commit
4250e99e3a
@ -3403,11 +3403,18 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a popup message to the player
|
||||
*
|
||||
* TODO: add translation type popups
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $subtitle @deprecated
|
||||
*/
|
||||
public function sendPopup(string $message, string $subtitle = ""){
|
||||
$pk = new TextPacket();
|
||||
$pk->type = TextPacket::TYPE_POPUP;
|
||||
$pk->source = $message;
|
||||
$pk->message = $subtitle;
|
||||
$pk->message = $message;
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
||||
|
@ -36,21 +36,22 @@ class PlayerActionPacket extends DataPacket{
|
||||
const ACTION_STOP_BREAK = 2;
|
||||
const ACTION_GET_UPDATED_BLOCK = 3;
|
||||
const ACTION_DROP_ITEM = 4;
|
||||
const ACTION_STOP_SLEEPING = 5;
|
||||
const ACTION_RESPAWN = 6;
|
||||
const ACTION_JUMP = 7;
|
||||
const ACTION_START_SPRINT = 8;
|
||||
const ACTION_STOP_SPRINT = 9;
|
||||
const ACTION_START_SNEAK = 10;
|
||||
const ACTION_STOP_SNEAK = 11;
|
||||
const ACTION_DIMENSION_CHANGE_REQUEST = 12; //sent when dying in different dimension
|
||||
const ACTION_DIMENSION_CHANGE_ACK = 13; //sent when spawning in a different dimension to tell the server we spawned
|
||||
const ACTION_START_GLIDE = 14;
|
||||
const ACTION_STOP_GLIDE = 15;
|
||||
const ACTION_BUILD_DENIED = 16;
|
||||
const ACTION_CONTINUE_BREAK = 17;
|
||||
const ACTION_START_SLEEPING = 5;
|
||||
const ACTION_STOP_SLEEPING = 6;
|
||||
const ACTION_RESPAWN = 7;
|
||||
const ACTION_JUMP = 8;
|
||||
const ACTION_START_SPRINT = 9;
|
||||
const ACTION_STOP_SPRINT = 10;
|
||||
const ACTION_START_SNEAK = 11;
|
||||
const ACTION_STOP_SNEAK = 12;
|
||||
const ACTION_DIMENSION_CHANGE_REQUEST = 13; //sent when dying in different dimension
|
||||
const ACTION_DIMENSION_CHANGE_ACK = 14; //sent when spawning in a different dimension to tell the server we spawned
|
||||
const ACTION_START_GLIDE = 15;
|
||||
const ACTION_STOP_GLIDE = 16;
|
||||
const ACTION_BUILD_DENIED = 17;
|
||||
const ACTION_CONTINUE_BREAK = 18;
|
||||
|
||||
const ACTION_SET_ENCHANTMENT_SEED = 19;
|
||||
const ACTION_SET_ENCHANTMENT_SEED = 20;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
|
@ -39,15 +39,15 @@ interface ProtocolInfo{
|
||||
/**
|
||||
* Actual Minecraft: PE protocol version
|
||||
*/
|
||||
const CURRENT_PROTOCOL = 133;
|
||||
const CURRENT_PROTOCOL = 134;
|
||||
/**
|
||||
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
|
||||
*/
|
||||
const MINECRAFT_VERSION = 'v1.2.0.18 beta';
|
||||
const MINECRAFT_VERSION = 'v1.2.0.22 beta';
|
||||
/**
|
||||
* Version number sent to clients in ping responses.
|
||||
*/
|
||||
const MINECRAFT_VERSION_NETWORK = '1.2.0.18';
|
||||
const MINECRAFT_VERSION_NETWORK = '1.2.0.22';
|
||||
|
||||
const LOGIN_PACKET = 0x01;
|
||||
const PLAY_STATUS_PACKET = 0x02;
|
||||
|
@ -34,19 +34,15 @@ class ShowStoreOfferPacket extends DataPacket{
|
||||
public $offerId;
|
||||
/** @var bool */
|
||||
public $unknownBool;
|
||||
/** @var string */
|
||||
public $unknownString;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->offerId = $this->getString();
|
||||
$this->unknownBool = $this->getBool();
|
||||
$this->unknownString = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putString($this->offerId);
|
||||
$this->putBool($this->unknownBool);
|
||||
$this->putString($this->unknownString);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user