mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 10:31:51 +00:00
NetworkStackLatencyPacket: added named constructors
This commit is contained in:
parent
d56cf35385
commit
1eabc3fe75
@ -35,6 +35,20 @@ class NetworkStackLatencyPacket extends DataPacket implements ClientboundPacket,
|
|||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $needResponse;
|
public $needResponse;
|
||||||
|
|
||||||
|
public static function request(int $timestampNs) : self{
|
||||||
|
$result = new self;
|
||||||
|
$result->timestamp = $timestampNs;
|
||||||
|
$result->needResponse = true;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function response(int $timestampNs) : self{
|
||||||
|
$result = new self;
|
||||||
|
$result->timestamp = $timestampNs;
|
||||||
|
$result->needResponse = false;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
protected function decodePayload(PacketSerializer $in) : void{
|
protected function decodePayload(PacketSerializer $in) : void{
|
||||||
$this->timestamp = $in->getLLong();
|
$this->timestamp = $in->getLLong();
|
||||||
$this->needResponse = $in->getBool();
|
$this->needResponse = $in->getBool();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user