mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Added Ping / Pong system
This commit is contained in:
parent
1cb30601b5
commit
1ef0a41944
3 changed files with 17 additions and 15 deletions
|
|
@ -53,20 +53,20 @@ class CustomPacketHandler{
|
|||
$this->offset = 0;
|
||||
$this->c = (bool) $create;
|
||||
switch($pid){
|
||||
case MC_KEEP_ALIVE:
|
||||
case MC_PING:
|
||||
if($this->c === false){
|
||||
$this->data["payload"] = Utils::readLong($this->get(8));
|
||||
$this->data["time"] = Utils::readLong($this->get(8));
|
||||
}else{
|
||||
$this->raw .= Utils::writeLong($this->data["payload"]);
|
||||
$this->raw .= Utils::writeLong($this->data["time"]);
|
||||
}
|
||||
break;
|
||||
case 0x03:
|
||||
case MC_PONG:
|
||||
if($this->c === false){
|
||||
$this->data["unknown1"] = Utils::readLong($this->get(8));
|
||||
$this->data["unknown2"] = Utils::readLong($this->get(8));
|
||||
$this->data["ptime"] = Utils::readLong($this->get(8));
|
||||
$this->data["time"] = Utils::readLong($this->get(8));
|
||||
}else{
|
||||
$this->raw .= Utils::writeLong($this->data["unknown1"]);
|
||||
$this->raw .= Utils::writeLong($this->data["unknown2"]);
|
||||
$this->raw .= Utils::writeLong($this->data["ptime"]);
|
||||
$this->raw .= Utils::writeLong($this->data["time"]);
|
||||
}
|
||||
break;
|
||||
case MC_CLIENT_CONNECT:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue