Level: Fixed leak of global packets when no players are online

If a global packet was broadcasted when no players were online, it would be held in memory indefinitely (until a player joined).
This commit is contained in:
Dylan K. Taylor 2018-08-06 18:44:53 +01:00
parent 70635d0870
commit 9e1fa453ad

View File

@ -797,8 +797,10 @@ class Level implements ChunkManager, Metadatable{
$this->checkSleep();
}
if(!empty($this->players) and !empty($this->globalPackets)){
$this->server->batchPackets($this->players, $this->globalPackets);
if(!empty($this->globalPackets)){
if(!empty($this->players)){
$this->server->batchPackets($this->players, $this->globalPackets);
}
$this->globalPackets = [];
}