PocketMine-MP 5.15.1 git-fb9a74e8799c71ed8292cfa53abe7a4c9204629d
pocketmine\network\mcpe\protocol\AvailableCommandsPacket Class Reference
+ Inheritance diagram for pocketmine\network\mcpe\protocol\AvailableCommandsPacket:
+ Collaboration diagram for pocketmine\network\mcpe\protocol\AvailableCommandsPacket:

Public Member Functions

 __get ($name)
 
 __set ($name, $value)
 
 canBeSentBeforeLogin ()
 
 decode (PacketSerializer $in)
 
 encode (PacketSerializer $out)
 
 getName ()
 
 handle (PacketHandlerInterface $handler)
 
 pid ()
 

Static Public Member Functions

static create (array $commandData, array $hardcodedEnums, array $softEnums, array $enumConstraints)
 

Public Attributes

array $commandData = []
 
array $enumConstraints = []
 
array $hardcodedEnums = []
 
int $recipientSubId = 0
 
int $senderSubId = 0
 
array $softEnums = []
 
const ARG_FLAG_ENUM = 0x200000
 
const ARG_FLAG_POSTFIX = 0x1000000
 
const ARG_FLAG_SOFT_ENUM = 0x4000000
 
const ARG_FLAG_VALID = 0x100000
 
const ARG_TYPE_BLOCK_STATES = ArgTypes::BLOCK_STATE_ARRAY
 
const ARG_TYPE_COMMAND = ArgTypes::SLASHCOMMAND
 
const ARG_TYPE_COMPARE_OPERATOR = ArgTypes::COMPAREOPERATOR
 
const ARG_TYPE_EQUIPMENT_SLOT = ArgTypes::EQUIPMENTSLOTENUM
 
const ARG_TYPE_FILEPATH = ArgTypes::PATHCOMMAND
 
const ARG_TYPE_FLOAT = ArgTypes::VAL
 
const ARG_TYPE_FULL_INTEGER_RANGE = ArgTypes::FULLINTEGERRANGE
 
const ARG_TYPE_INT = ArgTypes::INT
 
const ARG_TYPE_INT_POSITION = ArgTypes::POSITION
 
const ARG_TYPE_JSON = ArgTypes::JSON_OBJECT
 
const ARG_TYPE_MESSAGE = ArgTypes::MESSAGE_ROOT
 
const ARG_TYPE_OPERATOR = ArgTypes::OPERATOR
 
const ARG_TYPE_POSITION = ArgTypes::POSITION_FLOAT
 
const ARG_TYPE_RAWTEXT = ArgTypes::RAWTEXT
 
const ARG_TYPE_STRING = ArgTypes::ID
 
const ARG_TYPE_TARGET = ArgTypes::SELECTION
 
const ARG_TYPE_VALUE = ArgTypes::RVAL
 
const ARG_TYPE_WILDCARD_INT = ArgTypes::WILDCARDINT
 
const ARG_TYPE_WILDCARD_TARGET = ArgTypes::WILDCARDSELECTION
 
const HARDCODED_ENUM_NAMES
 
const NETWORK_ID = ProtocolInfo::AVAILABLE_COMMANDS_PACKET
 
const PID_MASK = 0x3ff
 

Protected Member Functions

 decodeHeader (PacketSerializer $in)
 
 decodePayload (PacketSerializer $in)
 
 encodeHeader (PacketSerializer $out)
 
 encodePayload (PacketSerializer $out)
 
 getCommandData (array $enums, array $postfixes, array $allChainedSubCommandData, PacketSerializer $in)
 
 getEnum (array $enumValueList, PacketSerializer $in)
 
 getEnumConstraint (array $enums, array $enumValues, PacketSerializer $in)
 
 getEnumValueIndex (int $valueCount, PacketSerializer $in)
 
 getSoftEnum (PacketSerializer $in)
 
 initSoftEnumsInCommandData ()
 
 putCommandData (CommandData $data, array $enumIndexes, array $softEnumIndexes, array $postfixIndexes, array $chainedSubCommandDataIndexes, PacketSerializer $out)
 
 putEnum (CommandEnum $enum, array $enumValueMap, PacketSerializer $out)
 
 putEnumConstraint (CommandEnumConstraint $constraint, array $enumIndexes, array $enumValueIndexes, PacketSerializer $out)
 
 putEnumValueIndex (int $index, int $valueCount, PacketSerializer $out)
 
 putSoftEnum (CommandEnum $enum, PacketSerializer $out)
 

Detailed Description

Definition at line 31 of file AvailableCommandsPacket.php.

Member Function Documentation

◆ __get()

pocketmine\network\mcpe\protocol\DataPacket::__get (   $name)
inherited
Parameters
string$name
Returns
mixed

Definition at line 105 of file DataPacket.php.

◆ __set()

pocketmine\network\mcpe\protocol\DataPacket::__set (   $name,
  $value 
)
inherited
Parameters
string$name
mixed$value

Definition at line 113 of file DataPacket.php.

◆ canBeSentBeforeLogin()

pocketmine\network\mcpe\protocol\DataPacket::canBeSentBeforeLogin ( )
inherited

Implements pocketmine\network\mcpe\protocol\Packet.

Definition at line 42 of file DataPacket.php.

◆ create()

static pocketmine\network\mcpe\protocol\AvailableCommandsPacket::create ( array  $commandData,
array  $hardcodedEnums,
array  $softEnums,
array  $enumConstraints 
)
static

@generate-create-func

Parameters
CommandData[]$commandData
CommandEnum[]$hardcodedEnums
CommandEnum[]$softEnums
CommandEnumConstraint[]$enumConstraints

Definition at line 122 of file AvailableCommandsPacket.php.

◆ decode()

pocketmine\network\mcpe\protocol\DataPacket::decode ( PacketSerializer  $in)
finalinherited
Exceptions
PacketDecodeException

Implements pocketmine\network\mcpe\protocol\Packet.

Definition at line 49 of file DataPacket.php.

◆ decodeHeader()

pocketmine\network\mcpe\protocol\DataPacket::decodeHeader ( PacketSerializer  $in)
protectedinherited
Exceptions
BinaryDataException
PacketDecodeException

Definition at line 62 of file DataPacket.php.

◆ decodePayload()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::decodePayload ( PacketSerializer  $in)
protected

Decodes the packet body, without the packet ID or other generic header fields.

Exceptions
PacketDecodeException
BinaryDataException

Reimplemented from pocketmine\network\mcpe\protocol\DataPacket.

Definition at line 131 of file AvailableCommandsPacket.php.

References pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getString().

+ Here is the call graph for this function:

◆ encode()

pocketmine\network\mcpe\protocol\DataPacket::encode ( PacketSerializer  $out)
finalinherited

Implements pocketmine\network\mcpe\protocol\Packet.

Definition at line 82 of file DataPacket.php.

◆ encodeHeader()

pocketmine\network\mcpe\protocol\DataPacket::encodeHeader ( PacketSerializer  $out)
protectedinherited

Definition at line 87 of file DataPacket.php.

◆ encodePayload()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::encodePayload ( PacketSerializer  $out)
protected

Encodes the packet body, without the packet ID or other generic header fields.

Reimplemented from pocketmine\network\mcpe\protocol\DataPacket.

Definition at line 454 of file AvailableCommandsPacket.php.

◆ getCommandData()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::getCommandData ( array  $enums,
array  $postfixes,
array  $allChainedSubCommandData,
PacketSerializer  $in 
)
protected
Parameters
CommandEnum[]$enums
string[]$postfixes
ChainedSubCommandData[]$allChainedSubCommandData
Exceptions
PacketDecodeException
BinaryDataException

Definition at line 352 of file AvailableCommandsPacket.php.

References pocketmine\utils\BinaryStream\getLShort().

+ Here is the call graph for this function:

◆ getEnum()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::getEnum ( array  $enumValueList,
PacketSerializer  $in 
)
protected
Parameters
string[]$enumValueList
Exceptions
PacketDecodeException
BinaryDataException

Definition at line 217 of file AvailableCommandsPacket.php.

◆ getEnumConstraint()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::getEnumConstraint ( array  $enums,
array  $enumValues,
PacketSerializer  $in 
)
protected
Parameters
CommandEnum[]$enums
string[]$enumValues
Exceptions
PacketDecodeException
BinaryDataException

Definition at line 307 of file AvailableCommandsPacket.php.

◆ getEnumValueIndex()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::getEnumValueIndex ( int  $valueCount,
PacketSerializer  $in 
)
protected
Exceptions
BinaryDataException

Definition at line 280 of file AvailableCommandsPacket.php.

References pocketmine\utils\BinaryStream\getByte().

+ Here is the call graph for this function:

◆ getName()

pocketmine\network\mcpe\protocol\DataPacket::getName ( )
inherited

Implements pocketmine\network\mcpe\protocol\Packet.

Definition at line 38 of file DataPacket.php.

◆ getSoftEnum()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::getSoftEnum ( PacketSerializer  $in)
protected
Exceptions
BinaryDataException

Definition at line 238 of file AvailableCommandsPacket.php.

References pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getString().

+ Here is the call graph for this function:

◆ handle()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::handle ( PacketHandlerInterface  $handler)

Performs handling for this packet. Usually you'll want an appropriately named method in the session handler for this.

This method returns a bool to indicate whether the packet was handled or not. If the packet was unhandled, a debug message will be logged with a hexdump of the packet.

Typically this method returns the return value of the handler in the supplied PacketHandler. See other packets for examples how to implement this.

Returns
bool true if the packet was handled successfully, false if not.
Exceptions
PacketDecodeExceptionif broken data was found in the packet

Implements pocketmine\network\mcpe\protocol\Packet.

Definition at line 604 of file AvailableCommandsPacket.php.

◆ initSoftEnumsInCommandData()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::initSoftEnumsInCommandData ( )
protected

Command data is decoded without referencing to any soft enums, as they are decoded afterwards. So we need to separately add soft enums to the command data

Definition at line 195 of file AvailableCommandsPacket.php.

◆ pid()

pocketmine\network\mcpe\protocol\DataPacket::pid ( )
inherited

Implements pocketmine\network\mcpe\protocol\Packet.

Definition at line 34 of file DataPacket.php.

◆ putCommandData()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::putCommandData ( CommandData  $data,
array  $enumIndexes,
array  $softEnumIndexes,
array  $postfixIndexes,
array  $chainedSubCommandDataIndexes,
PacketSerializer  $out 
)
protected
Parameters
int[]$enumIndexesstring enum name -> int index
int[]$softEnumIndexes
int[]$postfixIndexes
int[]$chainedSubCommandDataIndexes

Definition at line 406 of file AvailableCommandsPacket.php.

◆ putEnum()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::putEnum ( CommandEnum  $enum,
array  $enumValueMap,
PacketSerializer  $out 
)
protected
Parameters
int[]$enumValueMap

Definition at line 253 of file AvailableCommandsPacket.php.

◆ putEnumConstraint()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::putEnumConstraint ( CommandEnumConstraint  $constraint,
array  $enumIndexes,
array  $enumValueIndexes,
PacketSerializer  $out 
)
protected
Parameters
int[]$enumIndexesstring enum name -> int index
int[]$enumValueIndexesstring value -> int index

Definition at line 335 of file AvailableCommandsPacket.php.

◆ putEnumValueIndex()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::putEnumValueIndex ( int  $index,
int  $valueCount,
PacketSerializer  $out 
)
protected

Definition at line 290 of file AvailableCommandsPacket.php.

◆ putSoftEnum()

pocketmine\network\mcpe\protocol\AvailableCommandsPacket::putSoftEnum ( CommandEnum  $enum,
PacketSerializer  $out 
)
protected

Definition at line 267 of file AvailableCommandsPacket.php.

Member Data Documentation

◆ $commandData

array pocketmine\network\mcpe\protocol\AvailableCommandsPacket::$commandData = []

Definition at line 93 of file AvailableCommandsPacket.php.

◆ $enumConstraints

array pocketmine\network\mcpe\protocol\AvailableCommandsPacket::$enumConstraints = []

Definition at line 113 of file AvailableCommandsPacket.php.

◆ $hardcodedEnums

array pocketmine\network\mcpe\protocol\AvailableCommandsPacket::$hardcodedEnums = []

Definition at line 100 of file AvailableCommandsPacket.php.

◆ $recipientSubId

int pocketmine\network\mcpe\protocol\DataPacket::$recipientSubId = 0
inherited

Definition at line 32 of file DataPacket.php.

◆ $senderSubId

int pocketmine\network\mcpe\protocol\DataPacket::$senderSubId = 0
inherited

Definition at line 31 of file DataPacket.php.

◆ $softEnums

array pocketmine\network\mcpe\protocol\AvailableCommandsPacket::$softEnums = []

Definition at line 107 of file AvailableCommandsPacket.php.

◆ ARG_FLAG_ENUM

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_FLAG_ENUM = 0x200000

Enums are a little different: they are composed as follows: ARG_FLAG_ENUM | ARG_FLAG_VALID | (enum index)

Definition at line 78 of file AvailableCommandsPacket.php.

◆ ARG_FLAG_POSTFIX

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_FLAG_POSTFIX = 0x1000000

This is used for /xp <level: int>L. It can only be applied to integer parameters.

Definition at line 81 of file AvailableCommandsPacket.php.

◆ ARG_FLAG_SOFT_ENUM

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_FLAG_SOFT_ENUM = 0x4000000

Definition at line 83 of file AvailableCommandsPacket.php.

◆ ARG_FLAG_VALID

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_FLAG_VALID = 0x100000

This flag is set on all types EXCEPT the POSTFIX type. Not completely sure what this is for, but it is required for the argtype to work correctly. VALID seems as good a name as any.

Definition at line 38 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_BLOCK_STATES

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_BLOCK_STATES = ArgTypes::BLOCK_STATE_ARRAY

Definition at line 70 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_COMMAND

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_COMMAND = ArgTypes::SLASHCOMMAND

Definition at line 72 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_COMPARE_OPERATOR

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_COMPARE_OPERATOR = ArgTypes::COMPAREOPERATOR

Definition at line 49 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_EQUIPMENT_SLOT

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_EQUIPMENT_SLOT = ArgTypes::EQUIPMENTSLOTENUM

Definition at line 58 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_FILEPATH

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_FILEPATH = ArgTypes::PATHCOMMAND

Definition at line 54 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_FLOAT

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_FLOAT = ArgTypes::VAL

Definition at line 45 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_FULL_INTEGER_RANGE

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_FULL_INTEGER_RANGE = ArgTypes::FULLINTEGERRANGE

Definition at line 56 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_INT

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_INT = ArgTypes::INT

Basic parameter types. These must be combined with the ARG_FLAG_VALID constant. ARG_FLAG_VALID | (type const)

Definition at line 44 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_INT_POSITION

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_INT_POSITION = ArgTypes::POSITION

Definition at line 61 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_JSON

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_JSON = ArgTypes::JSON_OBJECT

Definition at line 68 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_MESSAGE

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_MESSAGE = ArgTypes::MESSAGE_ROOT

Definition at line 64 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_OPERATOR

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_OPERATOR = ArgTypes::OPERATOR

Definition at line 48 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_POSITION

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_POSITION = ArgTypes::POSITION_FLOAT

Definition at line 62 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_RAWTEXT

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_RAWTEXT = ArgTypes::RAWTEXT

Definition at line 66 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_STRING

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_STRING = ArgTypes::ID

Definition at line 59 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_TARGET

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_TARGET = ArgTypes::SELECTION

Definition at line 50 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_VALUE

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_VALUE = ArgTypes::RVAL

Definition at line 46 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_WILDCARD_INT

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_WILDCARD_INT = ArgTypes::WILDCARDINT

Definition at line 47 of file AvailableCommandsPacket.php.

◆ ARG_TYPE_WILDCARD_TARGET

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::ARG_TYPE_WILDCARD_TARGET = ArgTypes::WILDCARDSELECTION

Definition at line 52 of file AvailableCommandsPacket.php.

◆ HARDCODED_ENUM_NAMES

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::HARDCODED_ENUM_NAMES
Initial value:
= [
"CommandName" => true
]

Definition at line 85 of file AvailableCommandsPacket.php.

◆ NETWORK_ID

const pocketmine\network\mcpe\protocol\AvailableCommandsPacket::NETWORK_ID = ProtocolInfo::AVAILABLE_COMMANDS_PACKET

Definition at line 32 of file AvailableCommandsPacket.php.

◆ PID_MASK

const pocketmine\network\mcpe\protocol\DataPacket::PID_MASK = 0x3ff
inherited

Definition at line 25 of file DataPacket.php.


The documentation for this class was generated from the following file: