mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 00:39:45 +00:00
commit
3eb78fb0ff
@ -9,7 +9,7 @@ before_script:
|
||||
- echo | pecl install channel://pecl.php.net/yaml-2.0.4
|
||||
- git clone https://github.com/pmmp/pthreads.git
|
||||
- cd pthreads
|
||||
- git checkout 6ca019c58b4fa09ee2ff490f2444e34bef0773d0
|
||||
- git checkout 1b7da492b944146fa9680f6399bd9c6c6c6095e0
|
||||
- phpize
|
||||
- ./configure
|
||||
- make
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8666ae5add7a8b5213d68b491ebf0de211998cc9
|
||||
Subproject commit 185d7419914005530298bd5e069449bdf4c0be56
|
58
phpstan.neon
58
phpstan.neon
@ -2,6 +2,9 @@
|
||||
|
||||
parameters:
|
||||
level: 1
|
||||
autoload_files:
|
||||
- tests/phpstan/bootstrap.php
|
||||
- src/pocketmine/PocketMine.php
|
||||
paths:
|
||||
- src
|
||||
reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings
|
||||
@ -10,61 +13,6 @@ parameters:
|
||||
message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#"
|
||||
path: src/pocketmine/Player.php
|
||||
|
||||
-
|
||||
message: "#^Function pocketmine\\\\critical_error not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function pocketmine\\\\check_platform_dependencies not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function pocketmine\\\\emit_performance_warnings not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function pocketmine\\\\set_ini_entries not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function pocketmine\\\\server not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function check_platform_dependencies not found\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function critical_error not found\\.$#"
|
||||
count: 6
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function set_ini_entries not found\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function emit_performance_warnings not found\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Function pocketmine\\\\server not found\\.$#"
|
||||
count: 1
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^Constant MIN_PHP_VERSION not found\\.$#"
|
||||
count: 2
|
||||
path: src/pocketmine/PocketMine.php
|
||||
|
||||
-
|
||||
message: "#^pocketmine\\\\block\\\\[A-Za-z\\d]+\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
|
||||
path: src/pocketmine/block
|
||||
|
@ -291,5 +291,7 @@ namespace pocketmine {
|
||||
exit($exitCode);
|
||||
}
|
||||
|
||||
\pocketmine\server();
|
||||
if(!defined('pocketmine\_PHPSTAN_ANALYSIS')){
|
||||
\pocketmine\server();
|
||||
}
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an EntityUniqueID
|
||||
* Writes an EntityRuntimeID
|
||||
*
|
||||
* @param int $eid
|
||||
*/
|
||||
|
@ -34,6 +34,7 @@ use pocketmine\network\mcpe\protocol\AddPaintingPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddPlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\AdventureSettingsPacket;
|
||||
use pocketmine\network\mcpe\protocol\AnimatePacket;
|
||||
use pocketmine\network\mcpe\protocol\AnvilDamagePacket;
|
||||
use pocketmine\network\mcpe\protocol\AutomationClientConnectPacket;
|
||||
use pocketmine\network\mcpe\protocol\AvailableActorIdentifiersPacket;
|
||||
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
|
||||
@ -62,6 +63,8 @@ use pocketmine\network\mcpe\protocol\CraftingDataPacket;
|
||||
use pocketmine\network\mcpe\protocol\CraftingEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\DataPacket;
|
||||
use pocketmine\network\mcpe\protocol\DisconnectPacket;
|
||||
use pocketmine\network\mcpe\protocol\EducationSettingsPacket;
|
||||
use pocketmine\network\mcpe\protocol\EmotePacket;
|
||||
use pocketmine\network\mcpe\protocol\EventPacket;
|
||||
use pocketmine\network\mcpe\protocol\GameRulesChangedPacket;
|
||||
use pocketmine\network\mcpe\protocol\GuiDataPickItemPacket;
|
||||
@ -90,12 +93,15 @@ use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;
|
||||
use pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket;
|
||||
use pocketmine\network\mcpe\protocol\MoveActorDeltaPacket;
|
||||
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\MultiplayerSettingsPacket;
|
||||
use pocketmine\network\mcpe\protocol\NetworkChunkPublisherUpdatePacket;
|
||||
use pocketmine\network\mcpe\protocol\NetworkSettingsPacket;
|
||||
use pocketmine\network\mcpe\protocol\NetworkStackLatencyPacket;
|
||||
use pocketmine\network\mcpe\protocol\NpcRequestPacket;
|
||||
use pocketmine\network\mcpe\protocol\OnScreenTextureAnimationPacket;
|
||||
use pocketmine\network\mcpe\protocol\PhotoTransferPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerAuthInputPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerHotbarPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerInputPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerListPacket;
|
||||
@ -134,6 +140,7 @@ use pocketmine\network\mcpe\protocol\SetScoreboardIdentityPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetScorePacket;
|
||||
use pocketmine\network\mcpe\protocol\SetSpawnPositionPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetTimePacket;
|
||||
use pocketmine\network\mcpe\protocol\SettingsCommandPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetTitlePacket;
|
||||
use pocketmine\network\mcpe\protocol\ShowCreditsPacket;
|
||||
use pocketmine\network\mcpe\protocol\ShowProfilePacket;
|
||||
@ -144,11 +151,12 @@ use pocketmine\network\mcpe\protocol\SpawnParticleEffectPacket;
|
||||
use pocketmine\network\mcpe\protocol\StartGamePacket;
|
||||
use pocketmine\network\mcpe\protocol\StopSoundPacket;
|
||||
use pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket;
|
||||
use pocketmine\network\mcpe\protocol\StructureTemplateDataExportRequestPacket;
|
||||
use pocketmine\network\mcpe\protocol\StructureTemplateDataExportResponsePacket;
|
||||
use pocketmine\network\mcpe\protocol\StructureTemplateDataRequestPacket;
|
||||
use pocketmine\network\mcpe\protocol\StructureTemplateDataResponsePacket;
|
||||
use pocketmine\network\mcpe\protocol\SubClientLoginPacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemActorPacket;
|
||||
use pocketmine\network\mcpe\protocol\TextPacket;
|
||||
use pocketmine\network\mcpe\protocol\TickSyncPacket;
|
||||
use pocketmine\network\mcpe\protocol\TransferPacket;
|
||||
use pocketmine\network\mcpe\protocol\UpdateAttributesPacket;
|
||||
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
|
||||
@ -247,6 +255,10 @@ abstract class NetworkSession{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleTickSync(TickSyncPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleLevelSoundEventPacketV1(LevelSoundEventPacketV1 $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
@ -675,11 +687,11 @@ abstract class NetworkSession{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleStructureTemplateDataExportRequest(StructureTemplateDataExportRequestPacket $packet) : bool{
|
||||
public function handleStructureTemplateDataRequest(StructureTemplateDataRequestPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleStructureTemplateDataExportResponse(StructureTemplateDataExportResponsePacket $packet) : bool{
|
||||
public function handleStructureTemplateDataResponse(StructureTemplateDataResponsePacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -695,7 +707,35 @@ abstract class NetworkSession{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleEducationSettings(EducationSettingsPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleEmote(EmotePacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleMultiplayerSettings(MultiplayerSettingsPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleSettingsCommand(SettingsCommandPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleAnvilDamage(AnvilDamagePacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleCompletedUsingItem(CompletedUsingItemPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleNetworkSettings(NetworkSettingsPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handlePlayerAuthInput(PlayerAuthInputPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
78
src/pocketmine/network/mcpe/protocol/AnvilDamagePacket.php
Normal file
78
src/pocketmine/network/mcpe/protocol/AnvilDamagePacket.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class AnvilDamagePacket extends DataPacket/* implements ServerboundPacket*/{
|
||||
public const NETWORK_ID = ProtocolInfo::ANVIL_DAMAGE_PACKET;
|
||||
|
||||
/** @var int */
|
||||
private $x;
|
||||
/** @var int */
|
||||
private $y;
|
||||
/** @var int */
|
||||
private $z;
|
||||
/** @var int */
|
||||
private $damageAmount;
|
||||
|
||||
public static function create(int $x, int $y, int $z, int $damageAmount) : self{
|
||||
$result = new self;
|
||||
[$result->x, $result->y, $result->z] = [$x, $y, $z];
|
||||
$result->damageAmount = $damageAmount;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getDamageAmount() : int{
|
||||
return $this->damageAmount;
|
||||
}
|
||||
|
||||
public function getX() : int{
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
public function getY() : int{
|
||||
return $this->y;
|
||||
}
|
||||
|
||||
public function getZ() : int{
|
||||
return $this->z;
|
||||
}
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->damageAmount = $this->getByte();
|
||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putByte($this->damageAmount);
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleAnvilDamage($this);
|
||||
}
|
||||
}
|
@ -143,7 +143,7 @@ abstract class DataPacket extends NetworkBinaryStream{
|
||||
|
||||
public function __debugInfo(){
|
||||
$data = [];
|
||||
foreach($this as $k => $v){
|
||||
foreach((array) $this as $k => $v){
|
||||
if($k === "buffer" and is_string($v)){
|
||||
$data[$k] = bin2hex($v);
|
||||
}elseif(is_string($v) or (is_object($v) and method_exists($v, "__toString"))){
|
||||
|
@ -0,0 +1,44 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class EducationSettingsPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::EDUCATION_SETTINGS_PACKET;
|
||||
|
||||
protected function decodePayload() : void{
|
||||
//TODO
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleEducationSettings($this);
|
||||
}
|
||||
}
|
81
src/pocketmine/network/mcpe/protocol/EmotePacket.php
Normal file
81
src/pocketmine/network/mcpe/protocol/EmotePacket.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class EmotePacket extends DataPacket/* implements ClientboundPacket, ServerboundPacket*/{
|
||||
public const NETWORK_ID = ProtocolInfo::EMOTE_PACKET;
|
||||
|
||||
private const FLAG_SERVER = 1 << 0;
|
||||
|
||||
/** @var int */
|
||||
private $entityRuntimeId;
|
||||
/** @var string */
|
||||
private $emoteId;
|
||||
/** @var int */
|
||||
private $flags;
|
||||
|
||||
public static function create(int $entityRuntimeId, string $emoteId, int $flags) : self{
|
||||
$result = new self;
|
||||
$result->entityRuntimeId = $entityRuntimeId;
|
||||
$result->emoteId = $emoteId;
|
||||
$result->flags = $flags;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: we can't call this getEntityRuntimeId() because of base class collision (crap architecture, thanks Shoghi)
|
||||
* @return int
|
||||
*/
|
||||
public function getEntityRuntimeIdField() : int{
|
||||
return $this->entityRuntimeId;
|
||||
}
|
||||
|
||||
public function getEmoteId() : string{
|
||||
return $this->emoteId;
|
||||
}
|
||||
|
||||
public function getFlags() : int{
|
||||
return $this->flags;
|
||||
}
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->emoteId = $this->getString();
|
||||
$this->flags = $this->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putString($this->emoteId);
|
||||
$this->putByte($this->flags);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleEmote($this);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class MultiplayerSettingsPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MULTIPLAYER_SETTINGS_PACKET;
|
||||
|
||||
protected function decodePayload() : void{
|
||||
//TODO
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleMultiplayerSettings($this);
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class NetworkSettingsPacket extends DataPacket/* implements ClientboundPacket*/{
|
||||
public const NETWORK_ID = ProtocolInfo::NETWORK_SETTINGS_PACKET;
|
||||
|
||||
public const COMPRESS_NOTHING = 0;
|
||||
public const COMPRESS_EVERYTHING = 1;
|
||||
|
||||
/** @var int */
|
||||
private $compressionThreshold;
|
||||
|
||||
public static function create(int $compressionThreshold) : self{
|
||||
$result = new self;
|
||||
$result->compressionThreshold = $compressionThreshold;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getCompressionThreshold() : int{
|
||||
return $this->compressionThreshold;
|
||||
}
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->compressionThreshold = $this->getLShort();
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putLShort($this->compressionThreshold);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleNetworkSettings($this);
|
||||
}
|
||||
}
|
@ -54,6 +54,7 @@ class PacketPool{
|
||||
static::registerPacket(new RiderJumpPacket());
|
||||
static::registerPacket(new UpdateBlockPacket());
|
||||
static::registerPacket(new AddPaintingPacket());
|
||||
static::registerPacket(new TickSyncPacket());
|
||||
static::registerPacket(new LevelSoundEventPacketV1());
|
||||
static::registerPacket(new LevelEventPacket());
|
||||
static::registerPacket(new BlockEventPacket());
|
||||
@ -161,12 +162,19 @@ class PacketPool{
|
||||
static::registerPacket(new ClientCacheStatusPacket());
|
||||
static::registerPacket(new OnScreenTextureAnimationPacket());
|
||||
static::registerPacket(new MapCreateLockedCopyPacket());
|
||||
static::registerPacket(new StructureTemplateDataExportRequestPacket());
|
||||
static::registerPacket(new StructureTemplateDataExportResponsePacket());
|
||||
static::registerPacket(new StructureTemplateDataRequestPacket());
|
||||
static::registerPacket(new StructureTemplateDataResponsePacket());
|
||||
static::registerPacket(new UpdateBlockPropertiesPacket());
|
||||
static::registerPacket(new ClientCacheBlobStatusPacket());
|
||||
static::registerPacket(new ClientCacheMissResponsePacket());
|
||||
static::registerPacket(new EducationSettingsPacket());
|
||||
static::registerPacket(new EmotePacket());
|
||||
static::registerPacket(new MultiplayerSettingsPacket());
|
||||
static::registerPacket(new SettingsCommandPacket());
|
||||
static::registerPacket(new AnvilDamagePacket());
|
||||
static::registerPacket(new CompletedUsingItemPacket());
|
||||
static::registerPacket(new NetworkSettingsPacket());
|
||||
static::registerPacket(new PlayerAuthInputPacket());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,44 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class PlayerAuthInputPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::PLAYER_AUTH_INPUT_PACKET;
|
||||
|
||||
protected function decodePayload() : void{
|
||||
//TODO
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handlePlayerAuthInput($this);
|
||||
}
|
||||
}
|
@ -180,8 +180,8 @@ interface ProtocolInfo{
|
||||
public const CLIENT_CACHE_STATUS_PACKET = 0x81;
|
||||
public const ON_SCREEN_TEXTURE_ANIMATION_PACKET = 0x82;
|
||||
public const MAP_CREATE_LOCKED_COPY_PACKET = 0x83;
|
||||
public const STRUCTURE_TEMPLATE_DATA_EXPORT_REQUEST_PACKET = 0x84;
|
||||
public const STRUCTURE_TEMPLATE_DATA_EXPORT_RESPONSE_PACKET = 0x85;
|
||||
public const STRUCTURE_TEMPLATE_DATA_REQUEST_PACKET = 0x84;
|
||||
public const STRUCTURE_TEMPLATE_DATA_RESPONSE_PACKET = 0x85;
|
||||
public const UPDATE_BLOCK_PROPERTIES_PACKET = 0x86;
|
||||
public const CLIENT_CACHE_BLOB_STATUS_PACKET = 0x87;
|
||||
public const CLIENT_CACHE_MISS_RESPONSE_PACKET = 0x88;
|
||||
|
@ -44,6 +44,8 @@ class ResourcePackStackPacket extends DataPacket{
|
||||
|
||||
/** @var bool */
|
||||
public $isExperimental = false;
|
||||
/** @var string */
|
||||
public $baseGameVersion = ProtocolInfo::MINECRAFT_VERSION_NETWORK;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->mustAccept = $this->getBool();
|
||||
@ -62,6 +64,7 @@ class ResourcePackStackPacket extends DataPacket{
|
||||
}
|
||||
|
||||
$this->isExperimental = $this->getBool();
|
||||
$this->baseGameVersion = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
@ -82,6 +85,7 @@ class ResourcePackStackPacket extends DataPacket{
|
||||
}
|
||||
|
||||
$this->putBool($this->isExperimental);
|
||||
$this->putString($this->baseGameVersion);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -0,0 +1,66 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class SettingsCommandPacket extends DataPacket/* implements ServerboundPacket*/{
|
||||
public const NETWORK_ID = ProtocolInfo::SETTINGS_COMMAND_PACKET;
|
||||
|
||||
/** @var string */
|
||||
private $command;
|
||||
/** @var bool */
|
||||
private $suppressOutput;
|
||||
|
||||
public static function create(string $command, bool $suppressOutput) : self{
|
||||
$result = new self;
|
||||
$result->command = $command;
|
||||
$result->suppressOutput = $suppressOutput;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getCommand() : string{
|
||||
return $this->command;
|
||||
}
|
||||
|
||||
public function getSuppressOutput() : bool{
|
||||
return $this->suppressOutput;
|
||||
}
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->command = $this->getString();
|
||||
$this->suppressOutput = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putString($this->command);
|
||||
$this->putBool($this->suppressOutput);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleSettingsCommand($this);
|
||||
}
|
||||
}
|
@ -28,8 +28,8 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\network\mcpe\protocol\types\StructureSettings;
|
||||
|
||||
class StructureTemplateDataExportRequestPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::STRUCTURE_TEMPLATE_DATA_EXPORT_REQUEST_PACKET;
|
||||
class StructureTemplateDataRequestPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::STRUCTURE_TEMPLATE_DATA_REQUEST_PACKET;
|
||||
|
||||
public const TYPE_ALWAYS_LOAD = 1;
|
||||
public const TYPE_CREATE_AND_LOAD = 2;
|
||||
@ -62,6 +62,6 @@ class StructureTemplateDataExportRequestPacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleStructureTemplateDataExportRequest($this);
|
||||
return $handler->handleStructureTemplateDataRequest($this);
|
||||
}
|
||||
}
|
@ -27,8 +27,8 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class StructureTemplateDataExportResponsePacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::STRUCTURE_TEMPLATE_DATA_EXPORT_RESPONSE_PACKET;
|
||||
class StructureTemplateDataResponsePacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::STRUCTURE_TEMPLATE_DATA_RESPONSE_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $structureTemplateName;
|
||||
@ -51,6 +51,6 @@ class StructureTemplateDataExportResponsePacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleStructureTemplateDataExportResponse($this);
|
||||
return $handler->handleStructureTemplateDataResponse($this);
|
||||
}
|
||||
}
|
73
src/pocketmine/network/mcpe/protocol/TickSyncPacket.php
Normal file
73
src/pocketmine/network/mcpe/protocol/TickSyncPacket.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class TickSyncPacket extends DataPacket/* implements ClientboundPacket, ServerboundPacket*/{
|
||||
public const NETWORK_ID = ProtocolInfo::TICK_SYNC_PACKET;
|
||||
|
||||
/** @var int */
|
||||
private $clientSendTime;
|
||||
/** @var int */
|
||||
private $serverReceiveTime;
|
||||
|
||||
public static function request(int $clientTime) : self{
|
||||
$result = new self;
|
||||
$result->clientSendTime = $clientTime;
|
||||
$result->serverReceiveTime = 0; //useless
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function response(int $clientSendTime, int $serverReceiveTime) : self{
|
||||
$result = new self;
|
||||
$result->clientSendTime = $clientSendTime;
|
||||
$result->serverReceiveTime = $serverReceiveTime;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getClientSendTime() : int{
|
||||
return $this->clientSendTime;
|
||||
}
|
||||
|
||||
public function getServerReceiveTime() : int{
|
||||
return $this->serverReceiveTime;
|
||||
}
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->clientSendTime = $this->getLLong();
|
||||
$this->serverReceiveTime = $this->getLLong();
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putLLong($this->clientSendTime);
|
||||
$this->putLLong($this->serverReceiveTime);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleTickSync($this);
|
||||
}
|
||||
}
|
24
tests/phpstan/bootstrap.php
Normal file
24
tests/phpstan/bootstrap.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
define('pocketmine\_PHPSTAN_ANALYSIS', true);
|
Loading…
x
Reference in New Issue
Block a user