PocketMine-MP 5.21.1 git-2ff647079265e7c600203af4fd902b15e99d49a4
UnconnectedPong.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
21
22 public int $sendPingTime;
23 public int $serverId;
24 public string $serverName;
25
26 public static function create(int $sendPingTime, int $serverId, string $serverName) : self{
27 $result = new self;
28 $result->sendPingTime = $sendPingTime;
29 $result->serverId = $serverId;
30 $result->serverName = $serverName;
31 return $result;
32 }
33
34 protected function encodePayload(PacketSerializer $out) : void{
35 $out->putLong($this->sendPingTime);
36 $out->putLong($this->serverId);
37 $this->writeMagic($out);
38 $out->putString($this->serverName);
39 }
40
41 protected function decodePayload(PacketSerializer $in) : void{
42 $this->sendPingTime = $in->getLong();
43 $this->serverId = $in->getLong();
44 $this->readMagic($in);
45 $this->serverName = $in->getString();
46 }
47}
decodePayload(PacketSerializer $in)