PocketMine-MP
5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
CommandRequestPacket.php
1
<?php
2
3
/*
4
* This file is part of BedrockProtocol.
5
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6
*
7
* BedrockProtocol is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*/
12
13
declare(strict_types=1);
14
15
namespace
pocketmine\network\mcpe\protocol;
16
17
use
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
;
18
use
pocketmine\network\mcpe\protocol\types\command\CommandOriginData
;
19
20
class
CommandRequestPacket
extends
DataPacket
implements
ServerboundPacket
{
21
public
const
NETWORK_ID = ProtocolInfo::COMMAND_REQUEST_PACKET;
22
23
public
string
$command;
24
public
CommandOriginData
$originData;
25
public
bool
$isInternal;
26
public
int
$version;
27
31
public
static
function
create
(
string
$command,
CommandOriginData
$originData,
bool
$isInternal,
int
$version) : self{
32
$result = new self;
33
$result->command = $command;
34
$result->originData = $originData;
35
$result->isInternal = $isInternal;
36
$result->version = $version;
37
return
$result;
38
}
39
40
protected
function
decodePayload
(
PacketSerializer
$in) : void{
41
$this->command = $in->getString();
42
$this->originData = $in->
getCommandOriginData
();
43
$this->isInternal = $in->
getBool
();
44
$this->version = $in->
getVarInt
();
45
}
46
47
protected
function
encodePayload
(
PacketSerializer
$out) : void{
48
$out->putString($this->command);
49
$out->putCommandOriginData($this->originData);
50
$out->putBool($this->isInternal);
51
$out->
putVarInt
($this->version);
52
}
53
54
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
55
return $handler->handleCommandRequest($this);
56
}
57
}
pocketmine\network\mcpe\protocol\CommandRequestPacket
Definition
CommandRequestPacket.php:20
pocketmine\network\mcpe\protocol\CommandRequestPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
CommandRequestPacket.php:40
pocketmine\network\mcpe\protocol\CommandRequestPacket\handle
handle(PacketHandlerInterface $handler)
Definition
CommandRequestPacket.php:54
pocketmine\network\mcpe\protocol\CommandRequestPacket\create
static create(string $command, CommandOriginData $originData, bool $isInternal, int $version)
Definition
CommandRequestPacket.php:31
pocketmine\network\mcpe\protocol\CommandRequestPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
CommandRequestPacket.php:47
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getCommandOriginData
getCommandOriginData()
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:614
pocketmine\network\mcpe\protocol\types\command\CommandOriginData
Definition
CommandOriginData.php:19
pocketmine\utils\BinaryStream\putVarInt
putVarInt(int $v)
Definition
BinaryStream.php:331
pocketmine\utils\BinaryStream\getBool
getBool()
Definition
BinaryStream.php:105
pocketmine\utils\BinaryStream\getVarInt
getVarInt()
Definition
BinaryStream.php:324
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
pocketmine\network\mcpe\protocol\ServerboundPacket
Definition
ServerboundPacket.php:17
vendor
pocketmine
bedrock-protocol
src
CommandRequestPacket.php
Generated by
1.12.0