mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
Better Player queue completion limited by time
This commit is contained in:
parent
949ab34b42
commit
f7a12b09f7
@ -157,13 +157,10 @@ class Player{
|
|||||||
if($time > $this->timeout){
|
if($time > $this->timeout){
|
||||||
$this->close("timeout");
|
$this->close("timeout");
|
||||||
}else{
|
}else{
|
||||||
if($this->nextBuffer <= $time and strlen($this->buffer) > 0){
|
|
||||||
$this->sendBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!empty($this->queue)){
|
if(!empty($this->queue)){
|
||||||
$cnt = 0;
|
$cnt = 0;
|
||||||
while($cnt < 4){
|
$maxtime = $time + 0.025;
|
||||||
|
while(microtime(true) < $maxtime){
|
||||||
$p = array_shift($this->queue);
|
$p = array_shift($this->queue);
|
||||||
if($p === null){
|
if($p === null){
|
||||||
break;
|
break;
|
||||||
@ -179,6 +176,10 @@ class Player{
|
|||||||
++$cnt;
|
++$cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->nextBuffer <= $time and strlen($this->buffer) > 0){
|
||||||
|
$this->sendBuffer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user