-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathConnectedPing.php
More file actions
41 lines (32 loc) · 1.08 KB
/
ConnectedPing.php
File metadata and controls
41 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/*
* This file is part of RakLib.
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/RakLib>
*
* RakLib is not affiliated with Jenkins Software LLC nor RakNet.
*
* RakLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 raklib\protocol;
use pmmp\encoding\BE;
use pmmp\encoding\ByteBufferReader;
use pmmp\encoding\ByteBufferWriter;
class ConnectedPing extends ConnectedPacket{
public static $ID = MessageIdentifiers::ID_CONNECTED_PING;
public int $sendPingTime;
public static function create(int $sendPingTime) : self{
$result = new self;
$result->sendPingTime = $sendPingTime;
return $result;
}
protected function encodePayload(ByteBufferWriter $out) : void{
BE::writeUnsignedLong($out, $this->sendPingTime);
}
protected function decodePayload(ByteBufferReader $in) : void{
$this->sendPingTime = BE::readUnsignedLong($in);
}
}