PocketMine-MP 5.21.1 git-2ff647079265e7c600203af4fd902b15e99d49a4
OpenConnectionReply2.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
15declare(strict_types=1);
16
17namespace raklib\protocol;
18
20
23
24 public int $serverID;
25 public InternetAddress $clientAddress;
26 public int $mtuSize;
27 public bool $serverSecurity = false;
28
29 public static function create(int $serverId, InternetAddress $clientAddress, int $mtuSize, bool $serverSecurity) : self{
30 $result = new self;
31 $result->serverID = $serverId;
32 $result->clientAddress = $clientAddress;
33 $result->mtuSize = $mtuSize;
34 $result->serverSecurity = $serverSecurity;
35 return $result;
36 }
37
38 protected function encodePayload(PacketSerializer $out) : void{
39 $this->writeMagic($out);
40 $out->putLong($this->serverID);
41 $out->putAddress($this->clientAddress);
42 $out->putShort($this->mtuSize);
43 $out->putByte($this->serverSecurity ? 1 : 0);
44 }
45
46 protected function decodePayload(PacketSerializer $in) : void{
47 $this->readMagic($in);
48 $this->serverID = $in->getLong();
49 $this->clientAddress = $in->getAddress();
50 $this->mtuSize = $in->getShort();
51 $this->serverSecurity = $in->getByte() !== 0;
52 }
53}
const ID_OPEN_CONNECTION_REPLY_2
S2C: Header(1), OfflineMesageID(16), server GUID(8), mtu(2), doSecurity(1 bit), handshakeAnswer (if d...