Exploded Player->handleDataPacket() into 70+ methods

This commit is contained in:
Dylan K. Taylor 2017-02-26 15:51:11 +00:00
parent 8bf3b6bbea
commit 477cb77002
77 changed files with 2105 additions and 1130 deletions

File diff suppressed because it is too large Load Diff

View File

@ -252,7 +252,10 @@ class Network{
$pk->decode();
assert($pk->feof(), "Still " . strlen(substr($pk->buffer, $pk->offset)) . " bytes unread in " . get_class($pk));
$p->handleDataPacket($pk);
if(!$pk->handle($p)){
$logger = $this->server->getLogger();
$logger->debug("Unhandled " . get_class($pk) . " received from " . $p->getName());
}
}
}
}catch(\Throwable $e){

View File

@ -0,0 +1,263 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network;
use pocketmine\network\protocol\AddEntityPacket;
use pocketmine\network\protocol\AddHangingEntityPacket;
use pocketmine\network\protocol\AddItemEntityPacket;
use pocketmine\network\protocol\AddItemPacket;
use pocketmine\network\protocol\AddPaintingPacket;
use pocketmine\network\protocol\AddPlayerPacket;
use pocketmine\network\protocol\AdventureSettingsPacket;
use pocketmine\network\protocol\AnimatePacket;
use pocketmine\network\protocol\AvailableCommandsPacket;
use pocketmine\network\protocol\BatchPacket;
use pocketmine\network\protocol\BlockEntityDataPacket;
use pocketmine\network\protocol\BlockEventPacket;
use pocketmine\network\protocol\ChangeDimensionPacket;
use pocketmine\network\protocol\ChunkRadiusUpdatedPacket;
use pocketmine\network\protocol\CommandStepPacket;
use pocketmine\network\protocol\ContainerClosePacket;
use pocketmine\network\protocol\ContainerOpenPacket;
use pocketmine\network\protocol\ContainerSetContentPacket;
use pocketmine\network\protocol\ContainerSetDataPacket;
use pocketmine\network\protocol\ContainerSetSlotPacket;
use pocketmine\network\protocol\CraftingDataPacket;
use pocketmine\network\protocol\CraftingEventPacket;
use pocketmine\network\protocol\DisconnectPacket;
use pocketmine\network\protocol\DropItemPacket;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\network\protocol\ExplodePacket;
use pocketmine\network\protocol\FullChunkDataPacket;
use pocketmine\network\protocol\HurtArmorPacket;
use pocketmine\network\protocol\InteractPacket;
use pocketmine\network\protocol\InventoryActionPacket;
use pocketmine\network\protocol\ItemFrameDropItemPacket;
use pocketmine\network\protocol\LevelEventPacket;
use pocketmine\network\protocol\LevelSoundEventPacket;
use pocketmine\network\protocol\LoginPacket;
use pocketmine\network\protocol\MobArmorEquipmentPacket;
use pocketmine\network\protocol\MobEffectPacket;
use pocketmine\network\protocol\MobEquipmentPacket;
use pocketmine\network\protocol\MoveEntityPacket;
use pocketmine\network\protocol\MovePlayerPacket;
use pocketmine\network\protocol\PlayerActionPacket;
use pocketmine\network\protocol\PlayerFallPacket;
use pocketmine\network\protocol\PlayerInputPacket;
use pocketmine\network\protocol\PlayerListPacket;
use pocketmine\network\protocol\PlayStatusPacket;
use pocketmine\network\protocol\RemoveBlockPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
use pocketmine\network\protocol\ReplaceItemInSlotPacket;
use pocketmine\network\protocol\RequestChunkRadiusPacket;
use pocketmine\network\protocol\ResourcePackClientResponsePacket;
use pocketmine\network\protocol\ResourcePacksInfoPacket;
use pocketmine\network\protocol\ResourcePackStackPacket;
use pocketmine\network\protocol\RespawnPacket;
use pocketmine\network\protocol\RiderJumpPacket;
use pocketmine\network\protocol\SetCommandsEnabledPacket;
use pocketmine\network\protocol\SetDifficultyPacket;
use pocketmine\network\protocol\SetEntityDataPacket;
use pocketmine\network\protocol\SetEntityLinkPacket;
use pocketmine\network\protocol\SetEntityMotionPacket;
use pocketmine\network\protocol\SetHealthPacket;
use pocketmine\network\protocol\SetPlayerGameTypePacket;
use pocketmine\network\protocol\SetSpawnPositionPacket;
use pocketmine\network\protocol\SetTimePacket;
use pocketmine\network\protocol\ShowCreditsPacket;
use pocketmine\network\protocol\SpawnExperienceOrbPacket;
use pocketmine\network\protocol\StartGamePacket;
use pocketmine\network\protocol\TakeItemEntityPacket;
use pocketmine\network\protocol\TextPacket;
use pocketmine\network\protocol\TransferPacket;
use pocketmine\network\protocol\UpdateAttributesPacket;
use pocketmine\network\protocol\UpdateBlockPacket;
use pocketmine\network\protocol\UseItemPacket;
interface PocketEditionNetworkSession{
public function handleLogin(LoginPacket $packet) : bool;
public function handlePlayStatus(PlayStatusPacket $packet) : bool;
//public function handleServerToClientHandshake(ServerToClientHandshakePacket $packet) : bool; //TODO
//public function handleClientToServerHandshake(ClientToServerHandshakePacket $packet) : bool; //TODO
public function handleDisconnect(DisconnectPacket $packet) : bool;
public function handleBatch(BatchPacket $packet) : bool;
public function handleResourcePacksInfo(ResourcePacksInfoPacket $packet) : bool;
public function handleResourcePackStack(ResourcePackStackPacket $packet) : bool;
public function handleResourcePackClientResponse(ResourcePackClientResponsePacket $packet) : bool;
public function handleText(TextPacket $packet) : bool;
public function handleSetTime(SetTimePacket $packet) : bool;
public function handleStartGame(StartGamePacket $packet) : bool;
public function handleAddPlayer(AddPlayerPacket $packet) : bool;
public function handleAddEntity(AddEntityPacket $packet) : bool;
public function handleRemoveEntity(RemoveEntityPacket $packet) : bool;
public function handleAddItemEntity(AddItemEntityPacket $packet) : bool;
public function handleAddHangingEntity(AddHangingEntityPacket $packet) : bool;
public function handleTakeItemEntity(TakeItemEntityPacket $packet) : bool;
public function handleMoveEntity(MoveEntityPacket $packet) : bool;
public function handleMovePlayer(MovePlayerPacket $packet) : bool;
public function handleRiderJump(RiderJumpPacket $packet) : bool;
public function handleRemoveBlock(RemoveBlockPacket $packet) : bool;
public function handleUpdateBlock(UpdateBlockPacket $packet) : bool;
public function handleAddPainting(AddPaintingPacket $packet) : bool;
public function handleExplode(ExplodePacket $packet) : bool;
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool;
public function handleLevelEvent(LevelEventPacket $packet) : bool;
public function handleBlockEvent(BlockEventPacket $packet) : bool;
public function handleEntityEvent(EntityEventPacket $packet) : bool;
public function handleMobEffect(MobEffectPacket $packet) : bool;
public function handleUpdateAttributes(UpdateAttributesPacket $packet) : bool;
public function handleMobEquipment(MobEquipmentPacket $packet) : bool;
public function handleMobArmorEquipment(MobArmorEquipmentPacket $packet) : bool;
public function handleInteract(InteractPacket $packet) : bool;
public function handleUseItem(UseItemPacket $packet) : bool;
public function handlePlayerAction(PlayerActionPacket $packet) : bool;
public function handlePlayerFall(PlayerFallPacket $packet) : bool;
public function handleHurtArmor(HurtArmorPacket $packet) : bool;
public function handleSetEntityData(SetEntityDataPacket $packet) : bool;
public function handleSetEntityMotion(SetEntityMotionPacket $packet) : bool;
public function handleSetEntityLink(SetEntityLinkPacket $packet) : bool;
public function handleSetHealth(SetHealthPacket $packet) : bool;
public function handleSetSpawnPosition(SetSpawnPositionPacket $packet) : bool;
public function handleAnimate(AnimatePacket $packet) : bool;
public function handleRespawn(RespawnPacket $packet) : bool;
public function handleDropItem(DropItemPacket $packet) : bool;
public function handleInventoryAction(InventoryActionPacket $packet) : bool;
public function handleContainerOpen(ContainerOpenPacket $packet) : bool;
public function handleContainerClose(ContainerClosePacket $packet) : bool;
public function handleContainerSetSlot(ContainerSetSlotPacket $packet) : bool;
public function handleContainerSetData(ContainerSetDataPacket $packet) : bool;
public function handleContainerSetContent(ContainerSetContentPacket $packet) : bool;
public function handleCraftingData(CraftingDataPacket $packet) : bool;
public function handleCraftingEvent(CraftingEventPacket $packet) : bool;
public function handleAdventureSettings(AdventureSettingsPacket $packet) : bool;
public function handleBlockEntityData(BlockEntityDataPacket $packet) : bool;
public function handlePlayerInput(PlayerInputPacket $packet) : bool;
public function handleFullChunkData(FullChunkDataPacket $packet) : bool;
public function handleSetCommandsEnabled(SetCommandsEnabledPacket $packet) : bool;
public function handleSetDifficulty(SetDifficultyPacket $packet) : bool;
public function handleChangeDimension(ChangeDimensionPacket $packet) : bool;
public function handleSetPlayerGameType(SetPlayerGameTypePacket $packet) : bool;
public function handlePlayerList(PlayerListPacket $packet) : bool;
//public function handleTelemetryEvent(EventPacket $packet) : bool; //TODO
public function handleSpawnExperienceOrb(SpawnExperienceOrbPacket $packet) : bool;
//public function handleClientboundMapItemData(ClientboundMapItemDataPacket $packet) : bool; //TODO
//public function handleMapInfoRequest(MapInfoRequestPacket $packet) : bool; //TODO
public function handleRequestChunkRadius(RequestChunkRadiusPacket $packet) : bool;
public function handleChunkRadiusUpdated(ChunkRadiusUpdatedPacket $packet) : bool;
public function handleItemFrameDropItem(ItemFrameDropItemPacket $packet) : bool;
public function handleReplaceItemInSlot(ReplaceItemInSlotPacket $packet) : bool;
//public function handleGameRulesChanged(GameRulesChangedPacket $packet) : bool; //TODO
//public function handleCamera(CameraPacket $packet) : bool; //edu only :(
public function handleAddItem(AddItemPacket $packet) : bool;
//public function handleBossEvent(BossEventPacket $packet) : bool;
public function handleShowCredits(ShowCreditsPacket $packet) : bool;
public function handleAvailableCommands(AvailableCommandsPacket $packet) : bool;
public function handleCommandStep(CommandStepPacket $packet) : bool;
//public function handleResourcePackDataInfo(ResourcePackDataInfoPacket $packet) : bool; //TODO
//public function handleResourcePackChunkData(ResourcePackChunkDataPacket $packet) : bool; //TODO
//public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $packet) : bool; //TODO
public function handleTransfer(TransferPacket $packet) : bool;
}

View File

@ -134,7 +134,10 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
if($pk !== null){
$pk->decode();
assert($pk->feof(), "Still " . strlen(substr($pk->buffer, $pk->offset)) . " bytes unread!");
$this->players[$identifier]->handleDataPacket($pk);
if(!$pk->handle($this->players[$identifier])){
$logger = $this->server->getLogger();
$logger->debug("Unhandled " . get_class($pk) . " received from " . $this->players[$identifier]->getName());
}
}
}
}catch(\Throwable $e){

View File

@ -24,6 +24,7 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\entity\Attribute;
use pocketmine\network\PocketEditionNetworkSession;
class AddEntityPacket extends DataPacket{
const NETWORK_ID = Info::ADD_ENTITY_PACKET;
@ -72,4 +73,8 @@ class AddEntityPacket extends DataPacket{
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAddEntity($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class AddHangingEntityPacket extends DataPacket{
const NETWORK_ID = Info::ADD_HANGING_ENTITY_PACKET;
@ -45,4 +47,8 @@ class AddHangingEntityPacket extends DataPacket{
$this->putVarInt($this->unknown);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAddHangingEntity($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class AddItemEntityPacket extends DataPacket{
const NETWORK_ID = Info::ADD_ITEM_ENTITY_PACKET;
@ -49,4 +51,8 @@ class AddItemEntityPacket extends DataPacket{
$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAddItemEntity($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class AddItemPacket extends DataPacket{
const NETWORK_ID = Info::ADD_ITEM_PACKET;
@ -38,4 +40,8 @@ class AddItemPacket extends DataPacket{
$this->putSlot($this->item);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAddItem($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class AddPaintingPacket extends DataPacket{
const NETWORK_ID = Info::ADD_PAINTING_PACKET;
@ -47,4 +49,8 @@ class AddPaintingPacket extends DataPacket{
$this->putString($this->title);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAddPainting($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class AddPlayerPacket extends DataPacket{
const NETWORK_ID = Info::ADD_PLAYER_PACKET;
@ -60,4 +62,8 @@ class AddPlayerPacket extends DataPacket{
$this->putEntityMetadata($this->metadata);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAddPlayer($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class AdventureSettingsPacket extends DataPacket{
const NETWORK_ID = Info::ADVENTURE_SETTINGS_PACKET;
@ -95,4 +97,8 @@ class AdventureSettingsPacket extends DataPacket{
$this->putUnsignedVarInt($this->userPermission);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAdventureSettings($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class AnimatePacket extends DataPacket{
const NETWORK_ID = Info::ANIMATE_PACKET;
@ -41,4 +43,8 @@ class AnimatePacket extends DataPacket{
$this->putEntityId($this->eid);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAnimate($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class AvailableCommandsPacket extends DataPacket{
const NETWORK_ID = Info::AVAILABLE_COMMANDS_PACKET;
@ -39,4 +41,8 @@ class AvailableCommandsPacket extends DataPacket{
$this->putString($this->unknown);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleAvailableCommands($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class BatchPacket extends DataPacket{
const NETWORK_ID = Info::BATCH_PACKET;
@ -38,4 +40,8 @@ class BatchPacket extends DataPacket{
$this->putString($this->payload);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleBatch($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class BlockEntityDataPacket extends DataPacket{
const NETWORK_ID = Info::BLOCK_ENTITY_DATA_PACKET;
@ -43,4 +45,8 @@ class BlockEntityDataPacket extends DataPacket{
$this->put($this->namedtag);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleBlockEntityData($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class BlockEventPacket extends DataPacket{
const NETWORK_ID = Info::BLOCK_EVENT_PACKET;
@ -44,4 +46,8 @@ class BlockEventPacket extends DataPacket{
$this->putVarInt($this->case2);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleBlockEvent($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ChangeDimensionPacket extends DataPacket{
const NETWORK_ID = Info::CHANGE_DIMENSION_PACKET;
@ -47,4 +49,8 @@ class ChangeDimensionPacket extends DataPacket{
$this->putBool($this->unknown);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleChangeDimension($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ChunkRadiusUpdatedPacket extends DataPacket{
const NETWORK_ID = Info::CHUNK_RADIUS_UPDATED_PACKET;
@ -37,4 +39,8 @@ class ChunkRadiusUpdatedPacket extends DataPacket{
$this->putVarInt($this->radius);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleChunkRadiusUpdated($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class CommandStepPacket extends DataPacket{
const NETWORK_ID = Info::COMMAND_STEP_PACKET;
@ -65,4 +67,8 @@ class CommandStepPacket extends DataPacket{
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleCommandStep($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ContainerClosePacket extends DataPacket{
const NETWORK_ID = Info::CONTAINER_CLOSE_PACKET;
@ -38,4 +40,7 @@ class ContainerClosePacket extends DataPacket{
$this->putByte($this->windowid);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleContainerClose($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ContainerOpenPacket extends DataPacket{
const NETWORK_ID = Info::CONTAINER_OPEN_PACKET;
@ -48,4 +50,8 @@ class ContainerOpenPacket extends DataPacket{
$this->putEntityId($this->entityId);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleContainerOpen($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ContainerSetContentPacket extends DataPacket{
const NETWORK_ID = Info::CONTAINER_SET_CONTENT_PACKET;
@ -73,4 +75,8 @@ class ContainerSetContentPacket extends DataPacket{
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleContainerSetContent($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ContainerSetDataPacket extends DataPacket{
const NETWORK_ID = Info::CONTAINER_SET_DATA_PACKET;
@ -42,4 +44,8 @@ class ContainerSetDataPacket extends DataPacket{
$this->putVarInt($this->value);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleContainerSetData($this);
}
}

View File

@ -24,6 +24,7 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\item\Item;
use pocketmine\network\PocketEditionNetworkSession;
class ContainerSetSlotPacket extends DataPacket{
const NETWORK_ID = Info::CONTAINER_SET_SLOT_PACKET;
@ -52,4 +53,8 @@ class ContainerSetSlotPacket extends DataPacket{
$this->putByte($this->unknown);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleContainerSetSlot($this);
}
}

View File

@ -29,6 +29,7 @@ use pocketmine\inventory\MultiRecipe;
use pocketmine\inventory\ShapedRecipe;
use pocketmine\inventory\ShapelessRecipe;
use pocketmine\item\Item;
use pocketmine\network\PocketEditionNetworkSession;
use pocketmine\utils\BinaryStream;
class CraftingDataPacket extends DataPacket{
@ -198,4 +199,8 @@ class CraftingDataPacket extends DataPacket{
$this->putBool($this->cleanRecipes);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleCraftingData($this);
}
}

View File

@ -24,6 +24,7 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\item\Item;
use pocketmine\network\PocketEditionNetworkSession;
class CraftingEventPacket extends DataPacket{
const NETWORK_ID = Info::CRAFTING_EVENT_PACKET;
@ -62,4 +63,8 @@ class CraftingEventPacket extends DataPacket{
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleCraftingEvent($this);
}
}

View File

@ -25,6 +25,7 @@ namespace pocketmine\network\protocol;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\network\PocketEditionNetworkSession;
use pocketmine\utils\BinaryStream;
use pocketmine\utils\Utils;
@ -43,6 +44,8 @@ abstract class DataPacket extends BinaryStream{
abstract public function decode();
abstract public function handle(PocketEditionNetworkSession $session) : bool;
public function reset(){
$this->buffer = chr($this::NETWORK_ID);
$this->offset = 0;

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class DisconnectPacket extends DataPacket{
const NETWORK_ID = Info::DISCONNECT_PACKET;
@ -41,4 +43,8 @@ class DisconnectPacket extends DataPacket{
$this->putString($this->message);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleDisconnect($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class DropItemPacket extends DataPacket{
const NETWORK_ID = Info::DROP_ITEM_PACKET;
@ -39,4 +41,8 @@ class DropItemPacket extends DataPacket{
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleDropItem($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class EntityEventPacket extends DataPacket{
const NETWORK_ID = Info::ENTITY_EVENT_PACKET;
@ -62,4 +64,8 @@ class EntityEventPacket extends DataPacket{
$this->putVarInt($this->unknown);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleEntityEvent($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ExplodePacket extends DataPacket{
const NETWORK_ID = Info::EXPLODE_PACKET;
@ -54,4 +56,8 @@ class ExplodePacket extends DataPacket{
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleExplode($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class FullChunkDataPacket extends DataPacket{
const NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET;
@ -42,4 +44,8 @@ class FullChunkDataPacket extends DataPacket{
$this->putString($this->data);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleFullChunkData($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class HurtArmorPacket extends DataPacket{
const NETWORK_ID = Info::HURT_ARMOR_PACKET;
@ -38,4 +40,8 @@ class HurtArmorPacket extends DataPacket{
$this->putVarInt($this->health);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleHurtArmor($this);
}
}

View File

@ -117,4 +117,4 @@ interface Info{
const RESOURCE_PACK_CHUNK_REQUEST_PACKET = 0x51;
const TRANSFER_PACKET = 0x52;
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class InteractPacket extends DataPacket{
const NETWORK_ID = Info::INTERACT_PACKET;
@ -46,4 +48,8 @@ class InteractPacket extends DataPacket{
$this->putEntityId($this->target);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleInteract($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class InventoryActionPacket extends DataPacket{
const NETWORK_ID = Info::INVENTORY_ACTION_PACKET;
@ -37,4 +39,8 @@ class InventoryActionPacket extends DataPacket{
$this->putUnsignedVarInt($this->unknown);
$this->putSlot($this->item);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleInventoryAction($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ItemFrameDropItemPacket extends DataPacket{
const NETWORK_ID = Info::ITEM_FRAME_DROP_ITEM_PACKET;
@ -39,4 +41,8 @@ class ItemFrameDropItemPacket extends DataPacket{
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleItemFrameDropItem($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class LevelEventPacket extends DataPacket{
const NETWORK_ID = Info::LEVEL_EVENT_PACKET;
@ -107,4 +109,8 @@ class LevelEventPacket extends DataPacket{
$this->putVarInt($this->data);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleLevelEvent($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class LevelSoundEventPacket extends DataPacket{
const NETWORK_ID = Info::LEVEL_SOUND_EVENT_PACKET;
@ -146,4 +148,8 @@ class LevelSoundEventPacket extends DataPacket{
$this->putBool($this->unknownBool);
$this->putBool($this->unknownBool2);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleLevelSoundEvent($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class LoginPacket extends DataPacket{
const NETWORK_ID = Info::LOGIN_PACKET;
@ -93,4 +95,8 @@ class LoginPacket extends DataPacket{
return json_decode(base64_decode($payloadB64), true);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleLogin($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class MobArmorEquipmentPacket extends DataPacket{
const NETWORK_ID = Info::MOB_ARMOR_EQUIPMENT_PACKET;
@ -47,4 +49,8 @@ class MobArmorEquipmentPacket extends DataPacket{
$this->putSlot($this->slots[3]);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleMobArmorEquipment($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class MobEffectPacket extends DataPacket{
const NETWORK_ID = Info::MOB_EFFECT_PACKET;
@ -52,4 +54,8 @@ class MobEffectPacket extends DataPacket{
$this->putVarInt($this->duration);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleMobEffect($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class MobEquipmentPacket extends DataPacket{
const NETWORK_ID = Info::MOB_EQUIPMENT_PACKET;
@ -50,4 +52,8 @@ class MobEquipmentPacket extends DataPacket{
$this->putByte($this->unknownByte);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleMobEquipment($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class MoveEntityPacket extends DataPacket{
const NETWORK_ID = Info::MOVE_ENTITY_PACKET;
@ -52,4 +54,8 @@ class MoveEntityPacket extends DataPacket{
$this->putByte($this->headYaw / (360.0 / 256));
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleMoveEntity($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class MovePlayerPacket extends DataPacket{
const NETWORK_ID = Info::MOVE_PLAYER_PACKET;
@ -62,4 +64,8 @@ class MovePlayerPacket extends DataPacket{
$this->putBool($this->onGround);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleMovePlayer($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class PlayStatusPacket extends DataPacket{
const NETWORK_ID = Info::PLAY_STATUS_PACKET;
@ -45,4 +47,8 @@ class PlayStatusPacket extends DataPacket{
$this->putInt($this->status);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handlePlayStatus($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class PlayerActionPacket extends DataPacket{
const NETWORK_ID = Info::PLAYER_ACTION_PACKET;
@ -67,4 +69,8 @@ class PlayerActionPacket extends DataPacket{
$this->putVarInt($this->face);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handlePlayerAction($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class PlayerFallPacket extends DataPacket{
const NETWORK_ID = Info::PLAYER_FALL_PACKET;
@ -36,4 +38,8 @@ class PlayerFallPacket extends DataPacket{
public function encode(){
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handlePlayerFall($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class PlayerInputPacket extends DataPacket{
const NETWORK_ID = Info::PLAYER_INPUT_PACKET;
@ -43,4 +45,8 @@ class PlayerInputPacket extends DataPacket{
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handlePlayerInput($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class PlayerListPacket extends DataPacket{
const NETWORK_ID = Info::PLAYER_LIST_PACKET;
@ -61,4 +63,8 @@ class PlayerListPacket extends DataPacket{
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handlePlayerList($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class RemoveBlockPacket extends DataPacket{
const NETWORK_ID = Info::REMOVE_BLOCK_PACKET;
@ -39,4 +41,8 @@ class RemoveBlockPacket extends DataPacket{
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleRemoveBlock($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class RemoveEntityPacket extends DataPacket{
const NETWORK_ID = Info::REMOVE_ENTITY_PACKET;
@ -38,4 +40,8 @@ class RemoveEntityPacket extends DataPacket{
$this->putEntityId($this->eid);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleRemoveEntity($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ReplaceItemInSlotPacket extends DataPacket{
const NETWORK_ID = Info::REPLACE_ITEM_IN_SLOT_PACKET;
@ -38,4 +40,7 @@ class ReplaceItemInSlotPacket extends DataPacket{
$this->putSlot($this->item);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleReplaceItemInSlot($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class RequestChunkRadiusPacket extends DataPacket{
const NETWORK_ID = Info::REQUEST_CHUNK_RADIUS_PACKET;
@ -34,6 +36,11 @@ class RequestChunkRadiusPacket extends DataPacket{
}
public function encode(){
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleRequestChunkRadius($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ResourcePackClientResponsePacket extends DataPacket{
const NETWORK_ID = Info::RESOURCE_PACK_CLIENT_RESPONSE_PACKET;
@ -52,4 +54,8 @@ class ResourcePackClientResponsePacket extends DataPacket{
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleResourcePackClientResponse($this);
}
}

View File

@ -25,6 +25,7 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
use pocketmine\resourcepacks\ResourcePackInfoEntry;
class ResourcePackStackPacket extends DataPacket{
@ -70,4 +71,8 @@ class ResourcePackStackPacket extends DataPacket{
$this->putString($entry->getVersion());
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleResourcePackStack($this);
}
}

View File

@ -24,6 +24,7 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
use pocketmine\resourcepacks\ResourcePackInfoEntry;
class ResourcePacksInfoPacket extends DataPacket{
@ -71,4 +72,8 @@ class ResourcePacksInfoPacket extends DataPacket{
$this->putLLong($entry->getPackSize());
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleResourcePacksInfo($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class RespawnPacket extends DataPacket{
const NETWORK_ID = Info::RESPAWN_PACKET;
@ -44,4 +46,8 @@ class RespawnPacket extends DataPacket{
$this->putLFloat($this->z);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleRespawn($this);
}
}

View File

@ -25,6 +25,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class RiderJumpPacket extends DataPacket{
const NETWORK_ID = Info::RIDER_JUMP_PACKET;
@ -38,4 +40,8 @@ class RiderJumpPacket extends DataPacket{
$this->reset();
$this->putVarInt($this->unknown);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleRiderJump($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetCommandsEnabledPacket extends DataPacket{
const NETWORK_ID = Info::SET_COMMANDS_ENABLED_PACKET;
@ -38,4 +40,8 @@ class SetCommandsEnabledPacket extends DataPacket{
$this->putBool($this->enabled);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetCommandsEnabled($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetDifficultyPacket extends DataPacket{
const NETWORK_ID = Info::SET_DIFFICULTY_PACKET;
@ -38,4 +40,8 @@ class SetDifficultyPacket extends DataPacket{
$this->putUnsignedVarInt($this->difficulty);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetDifficulty($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetEntityDataPacket extends DataPacket{
const NETWORK_ID = Info::SET_ENTITY_DATA_PACKET;
@ -40,4 +42,7 @@ class SetEntityDataPacket extends DataPacket{
$this->putEntityMetadata($this->metadata);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetEntityData($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetEntityLinkPacket extends DataPacket{
const NETWORK_ID = Info::SET_ENTITY_LINK_PACKET;
@ -42,4 +44,8 @@ class SetEntityLinkPacket extends DataPacket{
$this->putByte($this->type);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetEntityLink($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetEntityMotionPacket extends DataPacket{
const NETWORK_ID = Info::SET_ENTITY_MOTION_PACKET;
@ -42,4 +44,8 @@ class SetEntityMotionPacket extends DataPacket{
$this->putVector3f($this->motionX, $this->motionY, $this->motionZ);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetEntityMotion($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetHealthPacket extends DataPacket{
const NETWORK_ID = Info::SET_HEALTH_PACKET;
@ -38,4 +40,8 @@ class SetHealthPacket extends DataPacket{
$this->putVarInt($this->health);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetHealth($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetPlayerGameTypePacket extends DataPacket{
const NETWORK_ID = Info::SET_PLAYER_GAME_TYPE_PACKET;
@ -38,4 +40,8 @@ class SetPlayerGameTypePacket extends DataPacket{
$this->putVarInt($this->gamemode);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetPlayerGameType($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetSpawnPositionPacket extends DataPacket{
const NETWORK_ID = Info::SET_SPAWN_POSITION_PACKET;
@ -44,4 +46,8 @@ class SetSpawnPositionPacket extends DataPacket{
$this->putBool($this->unknownBool);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetSpawnPosition($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SetTimePacket extends DataPacket{
const NETWORK_ID = Info::SET_TIME_PACKET;
@ -39,4 +41,8 @@ class SetTimePacket extends DataPacket{
$this->putBool($this->started);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSetTime($this);
}
}

View File

@ -25,6 +25,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class ShowCreditsPacket extends DataPacket{
const NETWORK_ID = Info::SHOW_CREDITS_PACKET;
@ -44,4 +46,8 @@ class ShowCreditsPacket extends DataPacket{
$this->putEntityId($this->playerEid);
$this->putVarInt($this->status);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleShowCredits($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class SpawnExperienceOrbPacket extends DataPacket{
const NETWORK_ID = Info::SPAWN_EXPERIENCE_ORB_PACKET;
@ -41,4 +43,8 @@ class SpawnExperienceOrbPacket extends DataPacket{
$this->putVector3f($this->x, $this->y, $this->z);
$this->putVarInt($this->amount);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleSpawnExperienceOrb($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class StartGamePacket extends DataPacket{
const NETWORK_ID = Info::START_GAME_PACKET;
@ -78,4 +80,8 @@ class StartGamePacket extends DataPacket{
$this->putString($this->worldName);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleStartGame($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class TakeItemEntityPacket extends DataPacket{
const NETWORK_ID = Info::TAKE_ITEM_ENTITY_PACKET;
@ -40,4 +42,7 @@ class TakeItemEntityPacket extends DataPacket{
$this->putEntityId($this->eid);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleTakeItemEntity($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class TextPacket extends DataPacket{
const NETWORK_ID = Info::TEXT_PACKET;
@ -87,4 +89,8 @@ class TextPacket extends DataPacket{
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleText($this);
}
}

View File

@ -23,6 +23,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class TransferPacket extends DataPacket{
const NETWORK_ID = Info::TRANSFER_PACKET;
@ -39,4 +41,8 @@ class TransferPacket extends DataPacket{
$this->putLShort($this->port);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleTransfer($this);
}
}

View File

@ -25,6 +25,7 @@ namespace pocketmine\network\protocol;
use pocketmine\entity\Attribute;
use pocketmine\network\PocketEditionNetworkSession;
class UpdateAttributesPacket extends DataPacket{
const NETWORK_ID = Info::UPDATE_ATTRIBUTES_PACKET;
@ -51,4 +52,8 @@ class UpdateAttributesPacket extends DataPacket{
}
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleUpdateAttributes($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class UpdateBlockPacket extends DataPacket{
const NETWORK_ID = Info::UPDATE_BLOCK_PACKET;
@ -54,4 +56,8 @@ class UpdateBlockPacket extends DataPacket{
$this->putUnsignedVarInt(($this->flags << 4) | $this->blockData);
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleUpdateBlock($this);
}
}

View File

@ -24,6 +24,8 @@ namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\PocketEditionNetworkSession;
class UseItemPacket extends DataPacket{
const NETWORK_ID = Info::USE_ITEM_PACKET;
@ -55,4 +57,8 @@ class UseItemPacket extends DataPacket{
}
public function handle(PocketEditionNetworkSession $session) : bool{
return $session->handleUseItem($this);
}
}