0
0
mirror of https://github.com/pmmp/BedrockProtocol.git synced 2025-02-23 12:46:15 +00:00
BedrockProtocol/src/SettingsCommandPacket.php
2022-01-10 21:21:59 +00:00

57 lines
1.5 KiB
PHP

<?php
/*
* This file is part of BedrockProtocol.
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
*
* BedrockProtocol 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.
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class SettingsCommandPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::SETTINGS_COMMAND_PACKET;
private string $command;
private bool $suppressOutput;
/**
* @generate-create-func
*/
public static function create(string $command, bool $suppressOutput) : self{
$result = new self;
$result->command = $command;
$result->suppressOutput = $suppressOutput;
return $result;
}
public function getCommand() : string{
return $this->command;
}
public function getSuppressOutput() : bool{
return $this->suppressOutput;
}
protected function decodePayload(PacketSerializer $in) : void{
$this->command = $in->getString();
$this->suppressOutput = $in->getBool();
}
protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->command);
$out->putBool($this->suppressOutput);
}
public function handle(PacketHandlerInterface $handler) : bool{
return $handler->handleSettingsCommand($this);
}
}