Level: fixed global packet mechanism spamming empty batch packets every tick

This also spammed to nobody when the level is empty.

Closes #2020.
This commit is contained in:
Dylan K. Taylor 2018-02-14 09:11:55 +00:00
parent 3600542d78
commit cacd0f5d8f

View File

@ -823,8 +823,10 @@ class Level implements ChunkManager, Metadatable{
$this->checkSleep();
}
$this->server->batchPackets($this->players, $this->globalPackets);
$this->globalPackets = [];
if(!empty($this->players) and !empty($this->globalPackets)){
$this->server->batchPackets($this->players, $this->globalPackets);
$this->globalPackets = [];
}
foreach($this->chunkPackets as $index => $entries){
Level::getXZ($index, $chunkX, $chunkZ);