Refactor a bunch of network-related things for easier auto-generation of protocol stuff

This commit is contained in:
Dylan K. Taylor 2017-07-12 16:32:39 +01:00
parent e485999218
commit 30df0c2418
16 changed files with 818 additions and 1115 deletions

View File

@ -26,104 +26,13 @@ declare(strict_types=1);
*/
namespace pocketmine\network;
use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\network\mcpe\protocol\AddHangingEntityPacket;
use pocketmine\network\mcpe\protocol\AddItemEntityPacket;
use pocketmine\network\mcpe\protocol\AddItemPacket;
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\AvailableCommandsPacket;
use pocketmine\network\mcpe\protocol\BatchPacket;
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
use pocketmine\network\mcpe\protocol\BlockEventPacket;
use pocketmine\network\mcpe\protocol\BlockPickRequestPacket;
use pocketmine\network\mcpe\protocol\BossEventPacket;
use pocketmine\network\mcpe\protocol\ChangeDimensionPacket;
use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket;
use pocketmine\network\mcpe\protocol\ClientboundMapItemDataPacket;
use pocketmine\network\mcpe\protocol\ClientToServerHandshakePacket;
use pocketmine\network\mcpe\protocol\CommandBlockUpdatePacket;
use pocketmine\network\mcpe\protocol\CommandStepPacket;
use pocketmine\network\mcpe\protocol\ContainerClosePacket;
use pocketmine\network\mcpe\protocol\ContainerOpenPacket;
use pocketmine\network\mcpe\protocol\ContainerSetContentPacket;
use pocketmine\network\mcpe\protocol\ContainerSetDataPacket;
use pocketmine\network\mcpe\protocol\ContainerSetSlotPacket;
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\DropItemPacket;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\network\mcpe\protocol\ExplodePacket;
use pocketmine\network\mcpe\protocol\FullChunkDataPacket;
use pocketmine\network\mcpe\protocol\GameRulesChangedPacket;
use pocketmine\network\mcpe\protocol\HurtArmorPacket;
use pocketmine\network\mcpe\protocol\InteractPacket;
use pocketmine\network\mcpe\protocol\InventoryActionPacket;
use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\network\mcpe\protocol\LoginPacket;
use pocketmine\network\mcpe\protocol\MapInfoRequestPacket;
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
use pocketmine\network\mcpe\protocol\MobEffectPacket;
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
use pocketmine\network\mcpe\protocol\MoveEntityPacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\EntityFallPacket;
use pocketmine\network\mcpe\protocol\PlayerInputPacket;
use pocketmine\network\mcpe\protocol\PlayerListPacket;
use pocketmine\network\mcpe\protocol\PlaySoundPacket;
use pocketmine\network\mcpe\protocol\PlayStatusPacket;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\network\mcpe\protocol\RemoveBlockPacket;
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
use pocketmine\network\mcpe\protocol\ReplaceItemInSlotPacket;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkRequestPacket;
use pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket;
use pocketmine\network\mcpe\protocol\ResourcePackDataInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePackStackPacket;
use pocketmine\network\mcpe\protocol\ResourcePacksInfoPacket;
use pocketmine\network\mcpe\protocol\RespawnPacket;
use pocketmine\network\mcpe\protocol\RiderJumpPacket;
use pocketmine\network\mcpe\protocol\ServerToClientHandshakePacket;
use pocketmine\network\mcpe\protocol\SetCommandsEnabledPacket;
use pocketmine\network\mcpe\protocol\SetDifficultyPacket;
use pocketmine\network\mcpe\protocol\SetEntityDataPacket;
use pocketmine\network\mcpe\protocol\SetEntityLinkPacket;
use pocketmine\network\mcpe\protocol\SetEntityMotionPacket;
use pocketmine\network\mcpe\protocol\SetHealthPacket;
use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket;
use pocketmine\network\mcpe\protocol\SetSpawnPositionPacket;
use pocketmine\network\mcpe\protocol\SetTimePacket;
use pocketmine\network\mcpe\protocol\SetTitlePacket;
use pocketmine\network\mcpe\protocol\ShowCreditsPacket;
use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket;
use pocketmine\network\mcpe\protocol\StartGamePacket;
use pocketmine\network\mcpe\protocol\StopSoundPacket;
use pocketmine\network\mcpe\protocol\TakeItemEntityPacket;
use pocketmine\network\mcpe\protocol\TextPacket;
use pocketmine\network\mcpe\protocol\TransferPacket;
use pocketmine\network\mcpe\protocol\UnknownPacket;
use pocketmine\network\mcpe\protocol\UpdateAttributesPacket;
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
use pocketmine\network\mcpe\protocol\UpdateTradePacket;
use pocketmine\network\mcpe\protocol\UseItemPacket;
use pocketmine\network\mcpe\protocol\PacketPool;
use pocketmine\Server;
class Network{
public static $BATCH_THRESHOLD = 512;
/** @var \SplFixedArray */
private $packetPool;
/** @var Server */
private $server;
@ -139,8 +48,7 @@ class Network{
private $name;
public function __construct(Server $server){
$this->registerPackets();
PacketPool::init();
$this->server = $server;
@ -230,33 +138,10 @@ class Network{
}
}
/**
* @param int $id 0-255
* @param DataPacket $class
*/
public function registerPacket($id, $class){
$this->packetPool[$id] = new $class;
}
public function getServer(){
return $this->server;
}
/**
* @param $id
*
* @return DataPacket
*/
public function getPacket($id){
/** @var DataPacket $class */
$class = $this->packetPool[$id];
if($class !== null){
return clone $class;
}
return new UnknownPacket();
}
/**
* @param string $address
* @param int $port
@ -279,96 +164,4 @@ class Network{
$interface->blockAddress($address, $timeout);
}
}
private function registerPackets(){
$this->packetPool = new \SplFixedArray(256);
$this->registerPacket(ProtocolInfo::ADD_ENTITY_PACKET, AddEntityPacket::class);
$this->registerPacket(ProtocolInfo::ADD_HANGING_ENTITY_PACKET, AddHangingEntityPacket::class);
$this->registerPacket(ProtocolInfo::ADD_ITEM_ENTITY_PACKET, AddItemEntityPacket::class);
$this->registerPacket(ProtocolInfo::ADD_ITEM_PACKET, AddItemPacket::class);
$this->registerPacket(ProtocolInfo::ADD_PAINTING_PACKET, AddPaintingPacket::class);
$this->registerPacket(ProtocolInfo::ADD_PLAYER_PACKET, AddPlayerPacket::class);
$this->registerPacket(ProtocolInfo::ADVENTURE_SETTINGS_PACKET, AdventureSettingsPacket::class);
$this->registerPacket(ProtocolInfo::ANIMATE_PACKET, AnimatePacket::class);
$this->registerPacket(ProtocolInfo::AVAILABLE_COMMANDS_PACKET, AvailableCommandsPacket::class);
$this->registerPacket(ProtocolInfo::BLOCK_ENTITY_DATA_PACKET, BlockEntityDataPacket::class);
$this->registerPacket(ProtocolInfo::BLOCK_EVENT_PACKET, BlockEventPacket::class);
$this->registerPacket(ProtocolInfo::BLOCK_PICK_REQUEST_PACKET, BlockPickRequestPacket::class);
$this->registerPacket(ProtocolInfo::BOSS_EVENT_PACKET, BossEventPacket::class);
$this->registerPacket(ProtocolInfo::CHANGE_DIMENSION_PACKET, ChangeDimensionPacket::class);
$this->registerPacket(ProtocolInfo::CHUNK_RADIUS_UPDATED_PACKET, ChunkRadiusUpdatedPacket::class);
$this->registerPacket(ProtocolInfo::CLIENTBOUND_MAP_ITEM_DATA_PACKET, ClientboundMapItemDataPacket::class);
$this->registerPacket(ProtocolInfo::CLIENT_TO_SERVER_HANDSHAKE_PACKET, ClientToServerHandshakePacket::class);
$this->registerPacket(ProtocolInfo::COMMAND_BLOCK_UPDATE_PACKET, CommandBlockUpdatePacket::class);
$this->registerPacket(ProtocolInfo::COMMAND_STEP_PACKET, CommandStepPacket::class);
$this->registerPacket(ProtocolInfo::CONTAINER_CLOSE_PACKET, ContainerClosePacket::class);
$this->registerPacket(ProtocolInfo::CONTAINER_OPEN_PACKET, ContainerOpenPacket::class);
$this->registerPacket(ProtocolInfo::CONTAINER_SET_CONTENT_PACKET, ContainerSetContentPacket::class);
$this->registerPacket(ProtocolInfo::CONTAINER_SET_DATA_PACKET, ContainerSetDataPacket::class);
$this->registerPacket(ProtocolInfo::CONTAINER_SET_SLOT_PACKET, ContainerSetSlotPacket::class);
$this->registerPacket(ProtocolInfo::CRAFTING_DATA_PACKET, CraftingDataPacket::class);
$this->registerPacket(ProtocolInfo::CRAFTING_EVENT_PACKET, CraftingEventPacket::class);
$this->registerPacket(ProtocolInfo::DISCONNECT_PACKET, DisconnectPacket::class);
$this->registerPacket(ProtocolInfo::DROP_ITEM_PACKET, DropItemPacket::class);
$this->registerPacket(ProtocolInfo::ENTITY_EVENT_PACKET, EntityEventPacket::class);
$this->registerPacket(ProtocolInfo::ENTITY_FALL_PACKET, EntityFallPacket::class);
$this->registerPacket(ProtocolInfo::EXPLODE_PACKET, ExplodePacket::class);
$this->registerPacket(ProtocolInfo::FULL_CHUNK_DATA_PACKET, FullChunkDataPacket::class);
$this->registerPacket(ProtocolInfo::GAME_RULES_CHANGED_PACKET, GameRulesChangedPacket::class);
$this->registerPacket(ProtocolInfo::HURT_ARMOR_PACKET, HurtArmorPacket::class);
$this->registerPacket(ProtocolInfo::INTERACT_PACKET, InteractPacket::class);
$this->registerPacket(ProtocolInfo::INVENTORY_ACTION_PACKET, InventoryActionPacket::class);
$this->registerPacket(ProtocolInfo::ITEM_FRAME_DROP_ITEM_PACKET, ItemFrameDropItemPacket::class);
$this->registerPacket(ProtocolInfo::LEVEL_EVENT_PACKET, LevelEventPacket::class);
$this->registerPacket(ProtocolInfo::LEVEL_SOUND_EVENT_PACKET, LevelSoundEventPacket::class);
$this->registerPacket(ProtocolInfo::LOGIN_PACKET, LoginPacket::class);
$this->registerPacket(ProtocolInfo::MAP_INFO_REQUEST_PACKET, MapInfoRequestPacket::class);
$this->registerPacket(ProtocolInfo::MOB_ARMOR_EQUIPMENT_PACKET, MobArmorEquipmentPacket::class);
$this->registerPacket(ProtocolInfo::MOB_EFFECT_PACKET, MobEffectPacket::class);
$this->registerPacket(ProtocolInfo::MOB_EQUIPMENT_PACKET, MobEquipmentPacket::class);
$this->registerPacket(ProtocolInfo::MOVE_ENTITY_PACKET, MoveEntityPacket::class);
$this->registerPacket(ProtocolInfo::MOVE_PLAYER_PACKET, MovePlayerPacket::class);
$this->registerPacket(ProtocolInfo::PLAYER_ACTION_PACKET, PlayerActionPacket::class);
$this->registerPacket(ProtocolInfo::PLAYER_INPUT_PACKET, PlayerInputPacket::class);
$this->registerPacket(ProtocolInfo::PLAYER_LIST_PACKET, PlayerListPacket::class);
$this->registerPacket(ProtocolInfo::PLAY_SOUND_PACKET, PlaySoundPacket::class);
$this->registerPacket(ProtocolInfo::PLAY_STATUS_PACKET, PlayStatusPacket::class);
$this->registerPacket(ProtocolInfo::REMOVE_BLOCK_PACKET, RemoveBlockPacket::class);
$this->registerPacket(ProtocolInfo::REMOVE_ENTITY_PACKET, RemoveEntityPacket::class);
$this->registerPacket(ProtocolInfo::REPLACE_ITEM_IN_SLOT_PACKET, ReplaceItemInSlotPacket::class);
$this->registerPacket(ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET, RequestChunkRadiusPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACKS_INFO_PACKET, ResourcePacksInfoPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_CHUNK_DATA_PACKET, ResourcePackChunkDataPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_CHUNK_REQUEST_PACKET, ResourcePackChunkRequestPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_CLIENT_RESPONSE_PACKET, ResourcePackClientResponsePacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_DATA_INFO_PACKET, ResourcePackDataInfoPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_STACK_PACKET, ResourcePackStackPacket::class);
$this->registerPacket(ProtocolInfo::RESPAWN_PACKET, RespawnPacket::class);
$this->registerPacket(ProtocolInfo::RIDER_JUMP_PACKET, RiderJumpPacket::class);
$this->registerPacket(ProtocolInfo::SERVER_TO_CLIENT_HANDSHAKE_PACKET, ServerToClientHandshakePacket::class);
$this->registerPacket(ProtocolInfo::SET_COMMANDS_ENABLED_PACKET, SetCommandsEnabledPacket::class);
$this->registerPacket(ProtocolInfo::SET_DIFFICULTY_PACKET, SetDifficultyPacket::class);
$this->registerPacket(ProtocolInfo::SET_ENTITY_DATA_PACKET, SetEntityDataPacket::class);
$this->registerPacket(ProtocolInfo::SET_ENTITY_LINK_PACKET, SetEntityLinkPacket::class);
$this->registerPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, SetEntityMotionPacket::class);
$this->registerPacket(ProtocolInfo::SET_HEALTH_PACKET, SetHealthPacket::class);
$this->registerPacket(ProtocolInfo::SET_PLAYER_GAME_TYPE_PACKET, SetPlayerGameTypePacket::class);
$this->registerPacket(ProtocolInfo::SET_SPAWN_POSITION_PACKET, SetSpawnPositionPacket::class);
$this->registerPacket(ProtocolInfo::SET_TIME_PACKET, SetTimePacket::class);
$this->registerPacket(ProtocolInfo::SET_TITLE_PACKET, SetTitlePacket::class);
$this->registerPacket(ProtocolInfo::SHOW_CREDITS_PACKET, ShowCreditsPacket::class);
$this->registerPacket(ProtocolInfo::SPAWN_EXPERIENCE_ORB_PACKET, SpawnExperienceOrbPacket::class);
$this->registerPacket(ProtocolInfo::START_GAME_PACKET, StartGamePacket::class);
$this->registerPacket(ProtocolInfo::STOP_SOUND_PACKET, StopSoundPacket::class);
$this->registerPacket(ProtocolInfo::TAKE_ITEM_ENTITY_PACKET, TakeItemEntityPacket::class);
$this->registerPacket(ProtocolInfo::TEXT_PACKET, TextPacket::class);
$this->registerPacket(ProtocolInfo::TRANSFER_PACKET, TransferPacket::class);
$this->registerPacket(ProtocolInfo::UPDATE_ATTRIBUTES_PACKET, UpdateAttributesPacket::class);
$this->registerPacket(ProtocolInfo::UPDATE_BLOCK_PACKET, UpdateBlockPacket::class);
$this->registerPacket(ProtocolInfo::UPDATE_TRADE_PACKET, UpdateTradePacket::class);
$this->registerPacket(ProtocolInfo::USE_ITEM_PACKET, UseItemPacket::class);
$this->registerPacket(0xfe, BatchPacket::class);
}
}

View File

@ -1,794 +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/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe;
use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\network\mcpe\protocol\AddHangingEntityPacket;
use pocketmine\network\mcpe\protocol\AddItemEntityPacket;
use pocketmine\network\mcpe\protocol\AddItemPacket;
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\AvailableCommandsPacket;
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
use pocketmine\network\mcpe\protocol\BlockEventPacket;
use pocketmine\network\mcpe\protocol\BlockPickRequestPacket;
use pocketmine\network\mcpe\protocol\BossEventPacket;
use pocketmine\network\mcpe\protocol\ChangeDimensionPacket;
use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket;
use pocketmine\network\mcpe\protocol\ClientboundMapItemDataPacket;
use pocketmine\network\mcpe\protocol\ClientToServerHandshakePacket;
use pocketmine\network\mcpe\protocol\CommandBlockUpdatePacket;
use pocketmine\network\mcpe\protocol\CommandStepPacket;
use pocketmine\network\mcpe\protocol\ContainerClosePacket;
use pocketmine\network\mcpe\protocol\ContainerOpenPacket;
use pocketmine\network\mcpe\protocol\ContainerSetContentPacket;
use pocketmine\network\mcpe\protocol\ContainerSetDataPacket;
use pocketmine\network\mcpe\protocol\ContainerSetSlotPacket;
use pocketmine\network\mcpe\protocol\CraftingDataPacket;
use pocketmine\network\mcpe\protocol\CraftingEventPacket;
use pocketmine\network\mcpe\protocol\DisconnectPacket;
use pocketmine\network\mcpe\protocol\DropItemPacket;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\network\mcpe\protocol\EntityFallPacket;
use pocketmine\network\mcpe\protocol\ExplodePacket;
use pocketmine\network\mcpe\protocol\FullChunkDataPacket;
use pocketmine\network\mcpe\protocol\GameRulesChangedPacket;
use pocketmine\network\mcpe\protocol\HurtArmorPacket;
use pocketmine\network\mcpe\protocol\InteractPacket;
use pocketmine\network\mcpe\protocol\InventoryActionPacket;
use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\network\mcpe\protocol\LoginPacket;
use pocketmine\network\mcpe\protocol\MapInfoRequestPacket;
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
use pocketmine\network\mcpe\protocol\MobEffectPacket;
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
use pocketmine\network\mcpe\protocol\MoveEntityPacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\PlayerInputPacket;
use pocketmine\network\mcpe\protocol\PlayerListPacket;
use pocketmine\network\mcpe\protocol\PlaySoundPacket;
use pocketmine\network\mcpe\protocol\PlayStatusPacket;
use pocketmine\network\mcpe\protocol\RemoveBlockPacket;
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
use pocketmine\network\mcpe\protocol\ReplaceItemInSlotPacket;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkRequestPacket;
use pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket;
use pocketmine\network\mcpe\protocol\ResourcePackDataInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePacksInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePackStackPacket;
use pocketmine\network\mcpe\protocol\RespawnPacket;
use pocketmine\network\mcpe\protocol\RiderJumpPacket;
use pocketmine\network\mcpe\protocol\ServerToClientHandshakePacket;
use pocketmine\network\mcpe\protocol\SetCommandsEnabledPacket;
use pocketmine\network\mcpe\protocol\SetDifficultyPacket;
use pocketmine\network\mcpe\protocol\SetEntityDataPacket;
use pocketmine\network\mcpe\protocol\SetEntityLinkPacket;
use pocketmine\network\mcpe\protocol\SetEntityMotionPacket;
use pocketmine\network\mcpe\protocol\SetHealthPacket;
use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket;
use pocketmine\network\mcpe\protocol\SetSpawnPositionPacket;
use pocketmine\network\mcpe\protocol\SetTimePacket;
use pocketmine\network\mcpe\protocol\SetTitlePacket;
use pocketmine\network\mcpe\protocol\ShowCreditsPacket;
use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket;
use pocketmine\network\mcpe\protocol\StartGamePacket;
use pocketmine\network\mcpe\protocol\StopSoundPacket;
use pocketmine\network\mcpe\protocol\TakeItemEntityPacket;
use pocketmine\network\mcpe\protocol\TextPacket;
use pocketmine\network\mcpe\protocol\TransferPacket;
use pocketmine\network\mcpe\protocol\UpdateAttributesPacket;
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
use pocketmine\network\mcpe\protocol\UpdateTradePacket;
use pocketmine\network\mcpe\protocol\UseItemPacket;
abstract class BaseNetworkSession implements NetworkSession{
/**
* @param LoginPacket $packet
* @return bool
*/
public function handleLogin(LoginPacket $packet) : bool{
return false;
}
/**
* @param PlayStatusPacket $packet
* @return bool
*/
public function handlePlayStatus(PlayStatusPacket $packet) : bool{
return false;
}
/**
* @param ServerToClientHandshakePacket $packet
* @return bool
*/
public function handleServerToClientHandshake(ServerToClientHandshakePacket $packet) : bool{
return false;
}
/**
* @param ClientToServerHandshakePacket $packet
* @return bool
*/
public function handleClientToServerHandshake(ClientToServerHandshakePacket $packet) : bool{
return false;
}
/**
* @param DisconnectPacket $packet
* @return bool
*/
public function handleDisconnect(DisconnectPacket $packet) : bool{
return false;
}
/**
* @param ResourcePacksInfoPacket $packet
* @return bool
*/
public function handleResourcePacksInfo(ResourcePacksInfoPacket $packet) : bool{
return false;
}
/**
* @param ResourcePackStackPacket $packet
* @return bool
*/
public function handleResourcePackStack(ResourcePackStackPacket $packet) : bool{
return false;
}
/**
* @param ResourcePackClientResponsePacket $packet
* @return bool
*/
public function handleResourcePackClientResponse(ResourcePackClientResponsePacket $packet) : bool{
return false;
}
/**
* @param TextPacket $packet
* @return bool
*/
public function handleText(TextPacket $packet) : bool{
return false;
}
/**
* @param SetTimePacket $packet
* @return bool
*/
public function handleSetTime(SetTimePacket $packet) : bool{
return false;
}
/**
* @param StartGamePacket $packet
* @return bool
*/
public function handleStartGame(StartGamePacket $packet) : bool{
return false;
}
/**
* @param AddPlayerPacket $packet
* @return bool
*/
public function handleAddPlayer(AddPlayerPacket $packet) : bool{
return false;
}
/**
* @param AddEntityPacket $packet
* @return bool
*/
public function handleAddEntity(AddEntityPacket $packet) : bool{
return false;
}
/**
* @param RemoveEntityPacket $packet
* @return bool
*/
public function handleRemoveEntity(RemoveEntityPacket $packet) : bool{
return false;
}
/**
* @param AddItemEntityPacket $packet
* @return bool
*/
public function handleAddItemEntity(AddItemEntityPacket $packet) : bool{
return false;
}
/**
* @param AddHangingEntityPacket $packet
* @return bool
*/
public function handleAddHangingEntity(AddHangingEntityPacket $packet) : bool{
return false;
}
/**
* @param TakeItemEntityPacket $packet
* @return bool
*/
public function handleTakeItemEntity(TakeItemEntityPacket $packet) : bool{
return false;
}
/**
* @param MoveEntityPacket $packet
* @return bool
*/
public function handleMoveEntity(MoveEntityPacket $packet) : bool{
return false;
}
/**
* @param MovePlayerPacket $packet
* @return bool
*/
public function handleMovePlayer(MovePlayerPacket $packet) : bool{
return false;
}
/**
* @param RiderJumpPacket $packet
* @return bool
*/
public function handleRiderJump(RiderJumpPacket $packet) : bool{
return false;
}
/**
* @param RemoveBlockPacket $packet
* @return bool
*/
public function handleRemoveBlock(RemoveBlockPacket $packet) : bool{
return false;
}
/**
* @param UpdateBlockPacket $packet
* @return bool
*/
public function handleUpdateBlock(UpdateBlockPacket $packet) : bool{
return false;
}
/**
* @param AddPaintingPacket $packet
* @return bool
*/
public function handleAddPainting(AddPaintingPacket $packet) : bool{
return false;
}
/**
* @param ExplodePacket $packet
* @return bool
*/
public function handleExplode(ExplodePacket $packet) : bool{
return false;
}
/**
* @param LevelSoundEventPacket $packet
* @return bool
*/
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
return false;
}
/**
* @param LevelEventPacket $packet
* @return bool
*/
public function handleLevelEvent(LevelEventPacket $packet) : bool{
return false;
}
/**
* @param BlockEventPacket $packet
* @return bool
*/
public function handleBlockEvent(BlockEventPacket $packet) : bool{
return false;
}
/**
* @param EntityEventPacket $packet
* @return bool
*/
public function handleEntityEvent(EntityEventPacket $packet) : bool{
return false;
}
/**
* @param MobEffectPacket $packet
* @return bool
*/
public function handleMobEffect(MobEffectPacket $packet) : bool{
return false;
}
/**
* @param UpdateAttributesPacket $packet
* @return bool
*/
public function handleUpdateAttributes(UpdateAttributesPacket $packet) : bool{
return false;
}
/**
* @param MobEquipmentPacket $packet
* @return bool
*/
public function handleMobEquipment(MobEquipmentPacket $packet) : bool{
return false;
}
/**
* @param MobArmorEquipmentPacket $packet
* @return bool
*/
public function handleMobArmorEquipment(MobArmorEquipmentPacket $packet) : bool{
return false;
}
/**
* @param InteractPacket $packet
* @return bool
*/
public function handleInteract(InteractPacket $packet) : bool{
return false;
}
/**
* @param BlockPickRequestPacket $packet
* @return bool
*/
public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool{
return false;
}
/**
* @param UseItemPacket $packet
* @return bool
*/
public function handleUseItem(UseItemPacket $packet) : bool{
return false;
}
/**
* @param PlayerActionPacket $packet
* @return bool
*/
public function handlePlayerAction(PlayerActionPacket $packet) : bool{
return false;
}
/**
* @param EntityFallPacket $packet
* @return bool
*/
public function handleEntityFall(EntityFallPacket $packet) : bool{
return false;
}
/**
* @param HurtArmorPacket $packet
* @return bool
*/
public function handleHurtArmor(HurtArmorPacket $packet) : bool{
return false;
}
/**
* @param SetEntityDataPacket $packet
* @return bool
*/
public function handleSetEntityData(SetEntityDataPacket $packet) : bool{
return false;
}
/**
* @param SetEntityMotionPacket $packet
* @return bool
*/
public function handleSetEntityMotion(SetEntityMotionPacket $packet) : bool{
return false;
}
/**
* @param SetEntityLinkPacket $packet
* @return bool
*/
public function handleSetEntityLink(SetEntityLinkPacket $packet) : bool{
return false;
}
/**
* @param SetHealthPacket $packet
* @return bool
*/
public function handleSetHealth(SetHealthPacket $packet) : bool{
return false;
}
/**
* @param SetSpawnPositionPacket $packet
* @return bool
*/
public function handleSetSpawnPosition(SetSpawnPositionPacket $packet) : bool{
return false;
}
/**
* @param AnimatePacket $packet
* @return bool
*/
public function handleAnimate(AnimatePacket $packet) : bool{
return false;
}
/**
* @param RespawnPacket $packet
* @return bool
*/
public function handleRespawn(RespawnPacket $packet) : bool{
return false;
}
/**
* @param DropItemPacket $packet
* @return bool
*/
public function handleDropItem(DropItemPacket $packet) : bool{
return false;
}
/**
* @param InventoryActionPacket $packet
* @return bool
*/
public function handleInventoryAction(InventoryActionPacket $packet) : bool{
return false;
}
/**
* @param ContainerOpenPacket $packet
* @return bool
*/
public function handleContainerOpen(ContainerOpenPacket $packet) : bool{
return false;
}
/**
* @param ContainerClosePacket $packet
* @return bool
*/
public function handleContainerClose(ContainerClosePacket $packet) : bool{
return false;
}
/**
* @param ContainerSetSlotPacket $packet
* @return bool
*/
public function handleContainerSetSlot(ContainerSetSlotPacket $packet) : bool{
return false;
}
/**
* @param ContainerSetDataPacket $packet
* @return bool
*/
public function handleContainerSetData(ContainerSetDataPacket $packet) : bool{
return false;
}
/**
* @param ContainerSetContentPacket $packet
* @return bool
*/
public function handleContainerSetContent(ContainerSetContentPacket $packet) : bool{
return false;
}
/**
* @param CraftingDataPacket $packet
* @return bool
*/
public function handleCraftingData(CraftingDataPacket $packet) : bool{
return false;
}
/**
* @param CraftingEventPacket $packet
* @return bool
*/
public function handleCraftingEvent(CraftingEventPacket $packet) : bool{
return false;
}
/**
* @param AdventureSettingsPacket $packet
* @return bool
*/
public function handleAdventureSettings(AdventureSettingsPacket $packet) : bool{
return false;
}
/**
* @param BlockEntityDataPacket $packet
* @return bool
*/
public function handleBlockEntityData(BlockEntityDataPacket $packet) : bool{
return false;
}
/**
* @param PlayerInputPacket $packet
* @return bool
*/
public function handlePlayerInput(PlayerInputPacket $packet) : bool{
return false;
}
/**
* @param FullChunkDataPacket $packet
* @return bool
*/
public function handleFullChunkData(FullChunkDataPacket $packet) : bool{
return false;
}
/**
* @param SetCommandsEnabledPacket $packet
* @return bool
*/
public function handleSetCommandsEnabled(SetCommandsEnabledPacket $packet) : bool{
return false;
}
/**
* @param SetDifficultyPacket $packet
* @return bool
*/
public function handleSetDifficulty(SetDifficultyPacket $packet) : bool{
return false;
}
/**
* @param ChangeDimensionPacket $packet
* @return bool
*/
public function handleChangeDimension(ChangeDimensionPacket $packet) : bool{
return false;
}
/**
* @param SetPlayerGameTypePacket $packet
* @return bool
*/
public function handleSetPlayerGameType(SetPlayerGameTypePacket $packet) : bool{
return false;
}
/**
* @param PlayerListPacket $packet
* @return bool
*/
public function handlePlayerList(PlayerListPacket $packet) : bool{
return false;
}
/**
* @param SpawnExperienceOrbPacket $packet
* @return bool
*/
public function handleSpawnExperienceOrb(SpawnExperienceOrbPacket $packet) : bool{
return false;
}
/**
* @param ClientboundMapItemDataPacket $packet
* @return bool
*/
public function handleClientboundMapItemData(ClientboundMapItemDataPacket $packet) : bool{
return false;
}
/**
* @param MapInfoRequestPacket $packet
* @return bool
*/
public function handleMapInfoRequest(MapInfoRequestPacket $packet) : bool{
return false;
}
/**
* @param RequestChunkRadiusPacket $packet
* @return bool
*/
public function handleRequestChunkRadius(RequestChunkRadiusPacket $packet) : bool{
return false;
}
/**
* @param ChunkRadiusUpdatedPacket $packet
* @return bool
*/
public function handleChunkRadiusUpdated(ChunkRadiusUpdatedPacket $packet) : bool{
return false;
}
/**
* @param ItemFrameDropItemPacket $packet
* @return bool
*/
public function handleItemFrameDropItem(ItemFrameDropItemPacket $packet) : bool{
return false;
}
/**
* @param ReplaceItemInSlotPacket $packet
* @return bool
*/
public function handleReplaceItemInSlot(ReplaceItemInSlotPacket $packet) : bool{
return false;
}
/**
* @param GameRulesChangedPacket $packet
* @return bool
*/
public function handleGameRulesChanged(GameRulesChangedPacket $packet) : bool{
return false;
}
/**
* @param AddItemPacket $packet
* @return bool
*/
public function handleAddItem(AddItemPacket $packet) : bool{
return false;
}
/**
* @param BossEventPacket $packet
* @return bool
*/
public function handleBossEvent(BossEventPacket $packet) : bool{
return false;
}
/**
* @param ShowCreditsPacket $packet
* @return bool
*/
public function handleShowCredits(ShowCreditsPacket $packet) : bool{
return false;
}
/**
* @param AvailableCommandsPacket $packet
* @return bool
*/
public function handleAvailableCommands(AvailableCommandsPacket $packet) : bool{
return false;
}
/**
* @param CommandStepPacket $packet
* @return bool
*/
public function handleCommandStep(CommandStepPacket $packet) : bool{
return false;
}
/**
* @param CommandBlockUpdatePacket $packet
* @return bool
*/
public function handleCommandBlockUpdate(CommandBlockUpdatePacket $packet) : bool{
return false;
}
/**
* @param UpdateTradePacket $packet
* @return bool
*/
public function handleUpdateTrade(UpdateTradePacket $packet) : bool{
return false;
}
/**
* @param ResourcePackDataInfoPacket $packet
* @return bool
*/
public function handleResourcePackDataInfo(ResourcePackDataInfoPacket $packet) : bool{
return false;
}
/**
* @param ResourcePackChunkDataPacket $packet
* @return bool
*/
public function handleResourcePackChunkData(ResourcePackChunkDataPacket $packet) : bool{
return false;
}
/**
* @param ResourcePackChunkRequestPacket $packet
* @return bool
*/
public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $packet) : bool{
return false;
}
/**
* @param TransferPacket $packet
* @return bool
*/
public function handleTransfer(TransferPacket $packet) : bool{
return false;
}
/**
* @param PlaySoundPacket $packet
* @return bool
*/
public function handlePlaySound(PlaySoundPacket $packet) : bool{
return false;
}
/**
* @param StopSoundPacket $packet
* @return bool
*/
public function handleStopSound(StopSoundPacket $packet) : bool{
return false;
}
/**
* @param SetTitlePacket $packet
* @return bool
*/
public function handleSetTitle(SetTitlePacket $packet) : bool{
return false;
}
}

View File

@ -21,10 +21,9 @@
declare(strict_types=1);
namespace pocketmine\network\mcpe;
use pocketmine\network\mcpe\protocol\AddBehaviorTreePacket;
use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\network\mcpe\protocol\AddHangingEntityPacket;
use pocketmine\network\mcpe\protocol\AddItemEntityPacket;
@ -38,10 +37,11 @@ use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
use pocketmine\network\mcpe\protocol\BlockEventPacket;
use pocketmine\network\mcpe\protocol\BlockPickRequestPacket;
use pocketmine\network\mcpe\protocol\BossEventPacket;
use pocketmine\network\mcpe\protocol\CameraPacket;
use pocketmine\network\mcpe\protocol\ChangeDimensionPacket;
use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket;
use pocketmine\network\mcpe\protocol\ClientboundMapItemDataPacket;
use pocketmine\network\mcpe\protocol\ClientToServerHandshakePacket;
use pocketmine\network\mcpe\protocol\ClientboundMapItemDataPacket;
use pocketmine\network\mcpe\protocol\CommandBlockUpdatePacket;
use pocketmine\network\mcpe\protocol\CommandStepPacket;
use pocketmine\network\mcpe\protocol\ContainerClosePacket;
@ -55,6 +55,8 @@ use pocketmine\network\mcpe\protocol\DataPacket;
use pocketmine\network\mcpe\protocol\DisconnectPacket;
use pocketmine\network\mcpe\protocol\DropItemPacket;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\network\mcpe\protocol\EntityFallPacket;
use pocketmine\network\mcpe\protocol\EventPacket;
use pocketmine\network\mcpe\protocol\ExplodePacket;
use pocketmine\network\mcpe\protocol\FullChunkDataPacket;
use pocketmine\network\mcpe\protocol\GameRulesChangedPacket;
@ -71,12 +73,12 @@ use pocketmine\network\mcpe\protocol\MobEffectPacket;
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
use pocketmine\network\mcpe\protocol\MoveEntityPacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\EntityFallPacket;
use pocketmine\network\mcpe\protocol\PlayerInputPacket;
use pocketmine\network\mcpe\protocol\PlayerListPacket;
use pocketmine\network\mcpe\protocol\PlaySoundPacket;
use pocketmine\network\mcpe\protocol\PlayStatusPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\PlayerInputPacket;
use pocketmine\network\mcpe\protocol\PlayerListPacket;
use pocketmine\network\mcpe\protocol\PurchaseReceiptPacket;
use pocketmine\network\mcpe\protocol\RemoveBlockPacket;
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
use pocketmine\network\mcpe\protocol\ReplaceItemInSlotPacket;
@ -85,8 +87,8 @@ use pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkRequestPacket;
use pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket;
use pocketmine\network\mcpe\protocol\ResourcePackDataInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePacksInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePackStackPacket;
use pocketmine\network\mcpe\protocol\ResourcePacksInfoPacket;
use pocketmine\network\mcpe\protocol\RespawnPacket;
use pocketmine\network\mcpe\protocol\RiderJumpPacket;
use pocketmine\network\mcpe\protocol\ServerToClientHandshakePacket;
@ -101,198 +103,395 @@ use pocketmine\network\mcpe\protocol\SetSpawnPositionPacket;
use pocketmine\network\mcpe\protocol\SetTimePacket;
use pocketmine\network\mcpe\protocol\SetTitlePacket;
use pocketmine\network\mcpe\protocol\ShowCreditsPacket;
use pocketmine\network\mcpe\protocol\ShowStoreOfferPacket;
use pocketmine\network\mcpe\protocol\SimpleEventPacket;
use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket;
use pocketmine\network\mcpe\protocol\StartGamePacket;
use pocketmine\network\mcpe\protocol\StopSoundPacket;
use pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket;
use pocketmine\network\mcpe\protocol\TakeItemEntityPacket;
use pocketmine\network\mcpe\protocol\TextPacket;
use pocketmine\network\mcpe\protocol\TransferPacket;
use pocketmine\network\mcpe\protocol\UpdateAttributesPacket;
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
use pocketmine\network\mcpe\protocol\UpdateEquipPacket;
use pocketmine\network\mcpe\protocol\UpdateTradePacket;
use pocketmine\network\mcpe\protocol\UseItemPacket;
use pocketmine\Server;
interface NetworkSession{
abstract class NetworkSession{
/**
* @return Server
*/
public function getServer();
abstract public function handleDataPacket(DataPacket $packet);
public function handleDataPacket(DataPacket $pk);
public function handleLogin(LoginPacket $packet) : bool{
return false;
}
public function handleLogin(LoginPacket $packet) : bool;
public function handlePlayStatus(PlayStatusPacket $packet) : bool{
return false;
}
public function handlePlayStatus(PlayStatusPacket $packet) : bool;
public function handleServerToClientHandshake(ServerToClientHandshakePacket $packet) : bool{
return false;
}
public function handleServerToClientHandshake(ServerToClientHandshakePacket $packet) : bool;
public function handleClientToServerHandshake(ClientToServerHandshakePacket $packet) : bool{
return false;
}
public function handleClientToServerHandshake(ClientToServerHandshakePacket $packet) : bool;
public function handleDisconnect(DisconnectPacket $packet) : bool{
return false;
}
public function handleDisconnect(DisconnectPacket $packet) : bool;
public function handleResourcePacksInfo(ResourcePacksInfoPacket $packet) : bool{
return false;
}
public function handleResourcePacksInfo(ResourcePacksInfoPacket $packet) : bool;
public function handleResourcePackStack(ResourcePackStackPacket $packet) : bool{
return false;
}
public function handleResourcePackStack(ResourcePackStackPacket $packet) : bool;
public function handleResourcePackClientResponse(ResourcePackClientResponsePacket $packet) : bool{
return false;
}
public function handleResourcePackClientResponse(ResourcePackClientResponsePacket $packet) : bool;
public function handleText(TextPacket $packet) : bool{
return false;
}
public function handleText(TextPacket $packet) : bool;
public function handleSetTime(SetTimePacket $packet) : bool{
return false;
}
public function handleSetTime(SetTimePacket $packet) : bool;
public function handleStartGame(StartGamePacket $packet) : bool{
return false;
}
public function handleStartGame(StartGamePacket $packet) : bool;
public function handleAddPlayer(AddPlayerPacket $packet) : bool{
return false;
}
public function handleAddPlayer(AddPlayerPacket $packet) : bool;
public function handleAddEntity(AddEntityPacket $packet) : bool{
return false;
}
public function handleAddEntity(AddEntityPacket $packet) : bool;
public function handleRemoveEntity(RemoveEntityPacket $packet) : bool{
return false;
}
public function handleRemoveEntity(RemoveEntityPacket $packet) : bool;
public function handleAddItemEntity(AddItemEntityPacket $packet) : bool{
return false;
}
public function handleAddItemEntity(AddItemEntityPacket $packet) : bool;
public function handleAddHangingEntity(AddHangingEntityPacket $packet) : bool{
return false;
}
public function handleAddHangingEntity(AddHangingEntityPacket $packet) : bool;
public function handleTakeItemEntity(TakeItemEntityPacket $packet) : bool{
return false;
}
public function handleTakeItemEntity(TakeItemEntityPacket $packet) : bool;
public function handleMoveEntity(MoveEntityPacket $packet) : bool{
return false;
}
public function handleMoveEntity(MoveEntityPacket $packet) : bool;
public function handleMovePlayer(MovePlayerPacket $packet) : bool{
return false;
}
public function handleMovePlayer(MovePlayerPacket $packet) : bool;
public function handleRiderJump(RiderJumpPacket $packet) : bool{
return false;
}
public function handleRiderJump(RiderJumpPacket $packet) : bool;
public function handleRemoveBlock(RemoveBlockPacket $packet) : bool{
return false;
}
public function handleRemoveBlock(RemoveBlockPacket $packet) : bool;
public function handleUpdateBlock(UpdateBlockPacket $packet) : bool{
return false;
}
public function handleUpdateBlock(UpdateBlockPacket $packet) : bool;
public function handleAddPainting(AddPaintingPacket $packet) : bool{
return false;
}
public function handleAddPainting(AddPaintingPacket $packet) : bool;
public function handleExplode(ExplodePacket $packet) : bool{
return false;
}
public function handleExplode(ExplodePacket $packet) : bool;
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
return false;
}
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool;
public function handleLevelEvent(LevelEventPacket $packet) : bool{
return false;
}
public function handleLevelEvent(LevelEventPacket $packet) : bool;
public function handleBlockEvent(BlockEventPacket $packet) : bool{
return false;
}
public function handleBlockEvent(BlockEventPacket $packet) : bool;
public function handleEntityEvent(EntityEventPacket $packet) : bool{
return false;
}
public function handleEntityEvent(EntityEventPacket $packet) : bool;
public function handleMobEffect(MobEffectPacket $packet) : bool{
return false;
}
public function handleMobEffect(MobEffectPacket $packet) : bool;
public function handleUpdateAttributes(UpdateAttributesPacket $packet) : bool{
return false;
}
public function handleUpdateAttributes(UpdateAttributesPacket $packet) : bool;
public function handleMobEquipment(MobEquipmentPacket $packet) : bool{
return false;
}
public function handleMobEquipment(MobEquipmentPacket $packet) : bool;
public function handleMobArmorEquipment(MobArmorEquipmentPacket $packet) : bool{
return false;
}
public function handleMobArmorEquipment(MobArmorEquipmentPacket $packet) : bool;
public function handleInteract(InteractPacket $packet) : bool{
return false;
}
public function handleInteract(InteractPacket $packet) : bool;
public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool{
return false;
}
public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool;
public function handleUseItem(UseItemPacket $packet) : bool{
return false;
}
public function handleUseItem(UseItemPacket $packet) : bool;
public function handlePlayerAction(PlayerActionPacket $packet) : bool{
return false;
}
public function handlePlayerAction(PlayerActionPacket $packet) : bool;
public function handleEntityFall(EntityFallPacket $packet) : bool{
return false;
}
public function handleEntityFall(EntityFallPacket $packet) : bool;
public function handleHurtArmor(HurtArmorPacket $packet) : bool{
return false;
}
public function handleHurtArmor(HurtArmorPacket $packet) : bool;
public function handleSetEntityData(SetEntityDataPacket $packet) : bool{
return false;
}
public function handleSetEntityData(SetEntityDataPacket $packet) : bool;
public function handleSetEntityMotion(SetEntityMotionPacket $packet) : bool{
return false;
}
public function handleSetEntityMotion(SetEntityMotionPacket $packet) : bool;
public function handleSetEntityLink(SetEntityLinkPacket $packet) : bool{
return false;
}
public function handleSetEntityLink(SetEntityLinkPacket $packet) : bool;
public function handleSetHealth(SetHealthPacket $packet) : bool{
return false;
}
public function handleSetHealth(SetHealthPacket $packet) : bool;
public function handleSetSpawnPosition(SetSpawnPositionPacket $packet) : bool{
return false;
}
public function handleSetSpawnPosition(SetSpawnPositionPacket $packet) : bool;
public function handleAnimate(AnimatePacket $packet) : bool{
return false;
}
public function handleAnimate(AnimatePacket $packet) : bool;
public function handleRespawn(RespawnPacket $packet) : bool{
return false;
}
public function handleRespawn(RespawnPacket $packet) : bool;
public function handleDropItem(DropItemPacket $packet) : bool{
return false;
}
public function handleDropItem(DropItemPacket $packet) : bool;
public function handleInventoryAction(InventoryActionPacket $packet) : bool{
return false;
}
public function handleInventoryAction(InventoryActionPacket $packet) : bool;
public function handleContainerOpen(ContainerOpenPacket $packet) : bool{
return false;
}
public function handleContainerOpen(ContainerOpenPacket $packet) : bool;
public function handleContainerClose(ContainerClosePacket $packet) : bool{
return false;
}
public function handleContainerClose(ContainerClosePacket $packet) : bool;
public function handleContainerSetSlot(ContainerSetSlotPacket $packet) : bool{
return false;
}
public function handleContainerSetSlot(ContainerSetSlotPacket $packet) : bool;
public function handleContainerSetData(ContainerSetDataPacket $packet) : bool{
return false;
}
public function handleContainerSetData(ContainerSetDataPacket $packet) : bool;
public function handleContainerSetContent(ContainerSetContentPacket $packet) : bool{
return false;
}
public function handleContainerSetContent(ContainerSetContentPacket $packet) : bool;
public function handleCraftingData(CraftingDataPacket $packet) : bool{
return false;
}
public function handleCraftingData(CraftingDataPacket $packet) : bool;
public function handleCraftingEvent(CraftingEventPacket $packet) : bool{
return false;
}
public function handleCraftingEvent(CraftingEventPacket $packet) : bool;
public function handleAdventureSettings(AdventureSettingsPacket $packet) : bool{
return false;
}
public function handleAdventureSettings(AdventureSettingsPacket $packet) : bool;
public function handleBlockEntityData(BlockEntityDataPacket $packet) : bool{
return false;
}
public function handleBlockEntityData(BlockEntityDataPacket $packet) : bool;
public function handlePlayerInput(PlayerInputPacket $packet) : bool{
return false;
}
public function handlePlayerInput(PlayerInputPacket $packet) : bool;
public function handleFullChunkData(FullChunkDataPacket $packet) : bool{
return false;
}
public function handleFullChunkData(FullChunkDataPacket $packet) : bool;
public function handleSetCommandsEnabled(SetCommandsEnabledPacket $packet) : bool{
return false;
}
public function handleSetCommandsEnabled(SetCommandsEnabledPacket $packet) : bool;
public function handleSetDifficulty(SetDifficultyPacket $packet) : bool{
return false;
}
public function handleSetDifficulty(SetDifficultyPacket $packet) : bool;
public function handleChangeDimension(ChangeDimensionPacket $packet) : bool{
return false;
}
public function handleChangeDimension(ChangeDimensionPacket $packet) : bool;
public function handleSetPlayerGameType(SetPlayerGameTypePacket $packet) : bool{
return false;
}
public function handleSetPlayerGameType(SetPlayerGameTypePacket $packet) : bool;
public function handlePlayerList(PlayerListPacket $packet) : bool{
return false;
}
public function handlePlayerList(PlayerListPacket $packet) : bool;
public function handleSimpleEvent(SimpleEventPacket $packet) : bool{
return false;
}
//public function handleTelemetryEvent(EventPacket $packet) : bool; //TODO
public function handleEvent(EventPacket $packet) : bool{
return false;
}
public function handleSpawnExperienceOrb(SpawnExperienceOrbPacket $packet) : bool;
public function handleSpawnExperienceOrb(SpawnExperienceOrbPacket $packet) : bool{
return false;
}
public function handleClientboundMapItemData(ClientboundMapItemDataPacket $packet) : bool;
public function handleClientboundMapItemData(ClientboundMapItemDataPacket $packet) : bool{
return false;
}
public function handleMapInfoRequest(MapInfoRequestPacket $packet) : bool; //TODO
public function handleMapInfoRequest(MapInfoRequestPacket $packet) : bool{
return false;
}
public function handleRequestChunkRadius(RequestChunkRadiusPacket $packet) : bool;
public function handleRequestChunkRadius(RequestChunkRadiusPacket $packet) : bool{
return false;
}
public function handleChunkRadiusUpdated(ChunkRadiusUpdatedPacket $packet) : bool;
public function handleChunkRadiusUpdated(ChunkRadiusUpdatedPacket $packet) : bool{
return false;
}
public function handleItemFrameDropItem(ItemFrameDropItemPacket $packet) : bool;
public function handleItemFrameDropItem(ItemFrameDropItemPacket $packet) : bool{
return false;
}
public function handleReplaceItemInSlot(ReplaceItemInSlotPacket $packet) : bool;
public function handleReplaceItemInSlot(ReplaceItemInSlotPacket $packet) : bool{
return false;
}
public function handleGameRulesChanged(GameRulesChangedPacket $packet) : bool;
public function handleGameRulesChanged(GameRulesChangedPacket $packet) : bool{
return false;
}
//public function handleCamera(CameraPacket $packet) : bool; //edu only :(
public function handleCamera(CameraPacket $packet) : bool{
return false;
}
public function handleAddItem(AddItemPacket $packet) : bool;
public function handleAddItem(AddItemPacket $packet) : bool{
return false;
}
public function handleBossEvent(BossEventPacket $packet) : bool;
public function handleBossEvent(BossEventPacket $packet) : bool{
return false;
}
public function handleShowCredits(ShowCreditsPacket $packet) : bool;
public function handleShowCredits(ShowCreditsPacket $packet) : bool{
return false;
}
public function handleAvailableCommands(AvailableCommandsPacket $packet) : bool;
public function handleAvailableCommands(AvailableCommandsPacket $packet) : bool{
return false;
}
public function handleCommandStep(CommandStepPacket $packet) : bool;
public function handleCommandStep(CommandStepPacket $packet) : bool{
return false;
}
public function handleCommandBlockUpdate(CommandBlockUpdatePacket $packet) : bool;
public function handleCommandBlockUpdate(CommandBlockUpdatePacket $packet) : bool{
return false;
}
public function handleUpdateTrade(UpdateTradePacket $packet) : bool;
public function handleUpdateTrade(UpdateTradePacket $packet) : bool{
return false;
}
public function handleResourcePackDataInfo(ResourcePackDataInfoPacket $packet) : bool;
public function handleUpdateEquip(UpdateEquipPacket $packet) : bool{
return false;
}
public function handleResourcePackChunkData(ResourcePackChunkDataPacket $packet) : bool;
public function handleResourcePackDataInfo(ResourcePackDataInfoPacket $packet) : bool{
return false;
}
public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $packet) : bool;
public function handleResourcePackChunkData(ResourcePackChunkDataPacket $packet) : bool{
return false;
}
public function handleTransfer(TransferPacket $packet) : bool;
public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $packet) : bool{
return false;
}
public function handlePlaySound(PlaySoundPacket $packet) : bool;
public function handleTransfer(TransferPacket $packet) : bool{
return false;
}
public function handleStopSound(StopSoundPacket $packet) : bool;
public function handlePlaySound(PlaySoundPacket $packet) : bool{
return false;
}
public function handleStopSound(StopSoundPacket $packet) : bool{
return false;
}
public function handleSetTitle(SetTitlePacket $packet) : bool{
return false;
}
public function handleAddBehaviorTree(AddBehaviorTreePacket $packet) : bool{
return false;
}
public function handleStructureBlockUpdate(StructureBlockUpdatePacket $packet) : bool{
return false;
}
public function handleShowStoreOffer(ShowStoreOfferPacket $packet) : bool{
return false;
}
public function handlePurchaseReceipt(PurchaseReceiptPacket $packet) : bool{
return false;
}
public function handleSetTitle(SetTitlePacket $packet) : bool;
}

View File

@ -63,7 +63,7 @@ use pocketmine\network\mcpe\protocol\UseItemPacket;
use pocketmine\Player;
use pocketmine\Server;
class PlayerNetworkSessionAdapter extends BaseNetworkSession{
class PlayerNetworkSessionAdapter extends NetworkSession{
/** @var Server */
private $server;
@ -75,10 +75,6 @@ class PlayerNetworkSessionAdapter extends BaseNetworkSession{
$this->player = $player;
}
public function getServer(){
return $this->server;
}
public function handleDataPacket(DataPacket $packet){
//TODO: Remove this hack once InteractPacket spam issue is fixed
if($packet->buffer === "\x21\x04\x00"){

View File

@ -27,6 +27,7 @@ use pocketmine\event\player\PlayerCreationEvent;
use pocketmine\network\AdvancedSourceInterface;
use pocketmine\network\mcpe\protocol\BatchPacket;
use pocketmine\network\mcpe\protocol\DataPacket;
use pocketmine\network\mcpe\protocol\PacketPool;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\network\Network;
use pocketmine\Player;
@ -236,7 +237,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
private function getPacket($buffer){
$pid = ord($buffer{0});
if(($data = $this->network->getPacket($pid)) === null){
if(($data = PacketPool::getPacketById($pid)) === null){
return null;
}
$data->setBuffer($buffer, 1);

View File

@ -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 AddBehaviorTreePacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::ADD_BEHAVIOR_TREE_PACKET;
public function decodePayload(){
//TODO
}
public function encodePayload(){
//TODO
}
public function handle(NetworkSession $session) : bool{
return $session->handleAddBehaviorTree($this);
}
}

View File

@ -91,10 +91,9 @@ class BatchPacket extends DataPacket{
$this->setBuffer($str, 0);
$network = $session->getServer()->getNetwork();
while(!$this->feof()){
$buf = $this->getString();
$pk = $network->getPacket(ord($buf{0}));
$pk = PacketPool::getPacketById(ord($buf{0}));
if(!$pk->canBeBatched()){
throw new \InvalidArgumentException("Received invalid " . get_class($pk) . " inside BatchPacket");

View File

@ -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 CameraPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::CAMERA_PACKET;
public function decodePayload(){
//TODO
}
public function encodePayload(){
//TODO
}
public function handle(NetworkSession $session) : bool{
return $session->handleCamera($this);
}
}

View File

@ -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 EventPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::EVENT_PACKET;
public function decodePayload(){
//TODO
}
public function encodePayload(){
//TODO
}
public function handle(NetworkSession $session) : bool{
return $session->handleEvent($this);
}
}

View File

@ -0,0 +1,157 @@
<?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;
class PacketPool{
/** @var \SplFixedArray<DataPacket> */
protected static $pool = null;
public static function init(){
static::$pool = new \SplFixedArray(256);
//Normal packets
static::registerPacket(new LoginPacket());
static::registerPacket(new PlayStatusPacket());
static::registerPacket(new ServerToClientHandshakePacket());
static::registerPacket(new ClientToServerHandshakePacket());
static::registerPacket(new DisconnectPacket());
static::registerPacket(new ResourcePacksInfoPacket());
static::registerPacket(new ResourcePackStackPacket());
static::registerPacket(new ResourcePackClientResponsePacket());
static::registerPacket(new TextPacket());
static::registerPacket(new SetTimePacket());
static::registerPacket(new StartGamePacket());
static::registerPacket(new AddPlayerPacket());
static::registerPacket(new AddEntityPacket());
static::registerPacket(new RemoveEntityPacket());
static::registerPacket(new AddItemEntityPacket());
static::registerPacket(new AddHangingEntityPacket());
static::registerPacket(new TakeItemEntityPacket());
static::registerPacket(new MoveEntityPacket());
static::registerPacket(new MovePlayerPacket());
static::registerPacket(new RiderJumpPacket());
static::registerPacket(new RemoveBlockPacket());
static::registerPacket(new UpdateBlockPacket());
static::registerPacket(new AddPaintingPacket());
static::registerPacket(new ExplodePacket());
static::registerPacket(new LevelSoundEventPacket());
static::registerPacket(new LevelEventPacket());
static::registerPacket(new BlockEventPacket());
static::registerPacket(new EntityEventPacket());
static::registerPacket(new MobEffectPacket());
static::registerPacket(new UpdateAttributesPacket());
static::registerPacket(new MobEquipmentPacket());
static::registerPacket(new MobArmorEquipmentPacket());
static::registerPacket(new InteractPacket());
static::registerPacket(new BlockPickRequestPacket());
static::registerPacket(new UseItemPacket());
static::registerPacket(new PlayerActionPacket());
static::registerPacket(new EntityFallPacket());
static::registerPacket(new HurtArmorPacket());
static::registerPacket(new SetEntityDataPacket());
static::registerPacket(new SetEntityMotionPacket());
static::registerPacket(new SetEntityLinkPacket());
static::registerPacket(new SetHealthPacket());
static::registerPacket(new SetSpawnPositionPacket());
static::registerPacket(new AnimatePacket());
static::registerPacket(new RespawnPacket());
static::registerPacket(new DropItemPacket());
static::registerPacket(new InventoryActionPacket());
static::registerPacket(new ContainerOpenPacket());
static::registerPacket(new ContainerClosePacket());
static::registerPacket(new ContainerSetSlotPacket());
static::registerPacket(new ContainerSetDataPacket());
static::registerPacket(new ContainerSetContentPacket());
static::registerPacket(new CraftingDataPacket());
static::registerPacket(new CraftingEventPacket());
static::registerPacket(new AdventureSettingsPacket());
static::registerPacket(new BlockEntityDataPacket());
static::registerPacket(new PlayerInputPacket());
static::registerPacket(new FullChunkDataPacket());
static::registerPacket(new SetCommandsEnabledPacket());
static::registerPacket(new SetDifficultyPacket());
static::registerPacket(new ChangeDimensionPacket());
static::registerPacket(new SetPlayerGameTypePacket());
static::registerPacket(new PlayerListPacket());
static::registerPacket(new SimpleEventPacket());
static::registerPacket(new EventPacket());
static::registerPacket(new SpawnExperienceOrbPacket());
static::registerPacket(new ClientboundMapItemDataPacket());
static::registerPacket(new MapInfoRequestPacket());
static::registerPacket(new RequestChunkRadiusPacket());
static::registerPacket(new ChunkRadiusUpdatedPacket());
static::registerPacket(new ItemFrameDropItemPacket());
static::registerPacket(new ReplaceItemInSlotPacket());
static::registerPacket(new GameRulesChangedPacket());
static::registerPacket(new CameraPacket());
static::registerPacket(new AddItemPacket());
static::registerPacket(new BossEventPacket());
static::registerPacket(new ShowCreditsPacket());
static::registerPacket(new AvailableCommandsPacket());
static::registerPacket(new CommandStepPacket());
static::registerPacket(new CommandBlockUpdatePacket());
static::registerPacket(new UpdateTradePacket());
static::registerPacket(new UpdateEquipPacket());
static::registerPacket(new ResourcePackDataInfoPacket());
static::registerPacket(new ResourcePackChunkDataPacket());
static::registerPacket(new ResourcePackChunkRequestPacket());
static::registerPacket(new TransferPacket());
static::registerPacket(new PlaySoundPacket());
static::registerPacket(new StopSoundPacket());
static::registerPacket(new SetTitlePacket());
static::registerPacket(new AddBehaviorTreePacket());
static::registerPacket(new StructureBlockUpdatePacket());
static::registerPacket(new ShowStoreOfferPacket());
static::registerPacket(new PurchaseReceiptPacket());
static::registerPacket(new BatchPacket());
}
/**
* @param DataPacket $packet
*/
public static function registerPacket(DataPacket $packet){
static::$pool[$packet->pid()] = clone $packet;
}
/**
* @param int $pid
* @return DataPacket
*/
public static function getPacketById(int $pid) : DataPacket{
return static::$pool[$pid] ?? new UnknownPacket();
}
/**
* @param string $buffer
* @return DataPacket
*/
public static function getPacket(string $buffer) : DataPacket{
$pk = static::getPacketById(ord($buffer{0}));
$pk->setBuffer($buffer);
return $pk;
}
}

View File

@ -43,11 +43,11 @@ interface ProtocolInfo{
/**
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
*/
const MINECRAFT_VERSION = 'v1.1.0.55';
const MINECRAFT_VERSION = 'v1.1.3.1 beta';
/**
* Version number sent to clients in ping responses.
*/
const MINECRAFT_VERSION_NETWORK = '1.1.0.55';
const MINECRAFT_VERSION_NETWORK = '1.1.3.1';
const LOGIN_PACKET = 0x01;
const PLAY_STATUS_PACKET = 0x02;

View File

@ -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 PurchaseReceiptPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::PURCHASE_RECEIPT_PACKET;
public function decodePayload(){
//TODO
}
public function encodePayload(){
//TODO
}
public function handle(NetworkSession $session) : bool{
return $session->handlePurchaseReceipt($this);
}
}

View File

@ -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 ShowStoreOfferPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::SHOW_STORE_OFFER_PACKET;
public function decodePayload(){
//TODO
}
public function encodePayload(){
//TODO
}
public function handle(NetworkSession $session) : bool{
return $session->handleShowStoreOffer($this);
}
}

View File

@ -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 SimpleEventPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::SIMPLE_EVENT_PACKET;
public function decodePayload(){
//TODO
}
public function encodePayload(){
//TODO
}
public function handle(NetworkSession $session) : bool{
return $session->handleSimpleEvent($this);
}
}

View File

@ -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 StructureBlockUpdatePacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::STRUCTURE_BLOCK_UPDATE_PACKET;
public function decodePayload(){
//TODO
}
public function encodePayload(){
//TODO
}
public function handle(NetworkSession $session) : bool{
return $session->handleStructureBlockUpdate($this);
}
}

View File

@ -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 UpdateEquipPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::UPDATE_EQUIP_PACKET;
public function decodePayload(){
//TODO
}
public function encodePayload(){
//TODO
}
public function handle(NetworkSession $session) : bool{
return $session->handleUpdateEquip($this);
}
}