PocketMine-MP
5.21.1 git-2ff647079265e7c600203af4fd902b15e99d49a4
OpenConnectionRequest1.php
1
<?php
2
3
/*
4
* This file is part of RakLib.
5
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/RakLib>
6
*
7
* RakLib is not affiliated with Jenkins Software LLC nor RakNet.
8
*
9
* RakLib is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
13
*/
14
15
declare(strict_types=1);
16
17
namespace
raklib\protocol;
18
19
use
raklib\RakLib
;
20
use
function
str_repeat;
21
use
function
strlen;
22
23
class
OpenConnectionRequest1
extends
OfflineMessage
{
24
public
static
$ID =
MessageIdentifiers::ID_OPEN_CONNECTION_REQUEST_1
;
25
26
public
int
$protocol =
RakLib::DEFAULT_PROTOCOL_VERSION
;
27
public
int
$mtuSize;
28
29
protected
function
encodePayload(
PacketSerializer
$out) :
void
{
30
$this->
writeMagic
($out);
31
$out->putByte($this->protocol);
32
$out->put(str_repeat(
"\x00"
, $this->mtuSize - strlen($out->getBuffer())));
33
}
34
35
protected
function
decodePayload
(
PacketSerializer
$in) : void{
36
$this->
readMagic
($in);
37
$this->protocol = $in->
getByte
();
38
$this->mtuSize = strlen($in->getBuffer());
39
$in->
getRemaining
();
//silence unread warnings
40
}
41
}
pocketmine\utils\BinaryStream\getByte
getByte()
Definition:
BinaryStream.php:117
pocketmine\utils\BinaryStream\getRemaining
getRemaining()
Definition:
BinaryStream.php:87
raklib\RakLib
Definition:
RakLib.php:19
raklib\RakLib\DEFAULT_PROTOCOL_VERSION
const DEFAULT_PROTOCOL_VERSION
Definition:
RakLib.php:24
raklib\protocol\OfflineMessage
Definition:
OfflineMessage.php:22
raklib\protocol\OfflineMessage\writeMagic
writeMagic(BinaryStream $out)
Definition:
OfflineMessage.php:42
raklib\protocol\OfflineMessage\readMagic
readMagic(BinaryStream $in)
Definition:
OfflineMessage.php:35
raklib\protocol\OpenConnectionRequest1
Definition:
OpenConnectionRequest1.php:23
raklib\protocol\OpenConnectionRequest1\decodePayload
decodePayload(PacketSerializer $in)
Definition:
OpenConnectionRequest1.php:35
raklib\protocol\PacketSerializer
Definition:
raklib/src/protocol/PacketSerializer.php:30
raklib\protocol\MessageIdentifiers\ID_OPEN_CONNECTION_REQUEST_1
const ID_OPEN_CONNECTION_REQUEST_1
Definition:
MessageIdentifiers.php:39
vendor
pocketmine
raklib
src
protocol
OpenConnectionRequest1.php
Generated by
1.9.3