mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 01:29:55 +00:00
Fixed client-side ACK & NACK
This commit is contained in:
parent
912e35f202
commit
e392a35598
@ -543,7 +543,7 @@ class Player{
|
|||||||
$this->recovery[$count] = null;
|
$this->recovery[$count] = null;
|
||||||
unset($this->recovery[$count]);
|
unset($this->recovery[$count]);
|
||||||
}
|
}
|
||||||
$limit = microtime(true) - 1; //max lag
|
$limit = microtime(true) - 2; //max lag
|
||||||
foreach($this->recovery as $count => $d){
|
foreach($this->recovery as $count => $d){
|
||||||
$diff = $this->counter[2] - $count;
|
$diff = $this->counter[2] - $count;
|
||||||
if($diff > 16 and $d["sendtime"] < $limit){
|
if($diff > 16 and $d["sendtime"] < $limit){
|
||||||
@ -584,13 +584,13 @@ class Player{
|
|||||||
$diff = $data[0] - $this->counter[1];
|
$diff = $data[0] - $this->counter[1];
|
||||||
if($diff > 1){ //Packet recovery
|
if($diff > 1){ //Packet recovery
|
||||||
for($i = $this->counter[1]; $i < $data[0]; ++$i){
|
for($i = $this->counter[1]; $i < $data[0]; ++$i){
|
||||||
$this->send(0xa0, array($i));
|
$this->send(0xa0, array(array($i)));
|
||||||
}
|
}
|
||||||
$this->counter[1] = $data[0];
|
$this->counter[1] = $data[0];
|
||||||
}elseif($diff === 1){
|
}elseif($diff === 1){
|
||||||
$this->counter[1] = $data[0];
|
$this->counter[1] = $data[0];
|
||||||
}
|
}
|
||||||
$this->send(0xc0, array($data[0]));
|
$this->send(0xc0, array(array($data[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($data["id"])){
|
if(!isset($data["id"])){
|
||||||
|
@ -62,15 +62,16 @@ class Packet{
|
|||||||
case 0xc0:
|
case 0xc0:
|
||||||
case 0xa0:
|
case 0xa0:
|
||||||
$cnt = 0;
|
$cnt = 0;
|
||||||
$this->addRaw(Utils::writeShort(floor(count($this->data[$field]) / 2)));
|
$this->addRaw(Utils::writeShort(ceil(count($this->data[$field]) / 2)));
|
||||||
foreach($this->data[$field] as $i => $count){
|
foreach($this->data[$field] as $i => $count){
|
||||||
if(($cnt % 2) === 0){
|
if(($cnt % 2) === 0 or $cnt === 0){
|
||||||
if(count($this->data[$field]) > 1){
|
if(count($this->data[$field]) > 1){
|
||||||
$this->addRaw(Utils::writeBool(false));
|
$this->addRaw(Utils::writeBool(false));
|
||||||
}else{
|
}else{
|
||||||
$this->addRaw(Utils::writeBool(true));
|
$this->addRaw(Utils::writeBool(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
++$cnt;
|
||||||
$this->addRaw(strrev(Utils::writeTriad($count)));
|
$this->addRaw(strrev(Utils::writeTriad($count)));
|
||||||
unset($this->data[$field][$i]);
|
unset($this->data[$field][$i]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user