Fixed invisible FloatingTextParticle crashing the server, closes #2560

This commit is contained in:
Dylan K. Taylor 2018-12-13 18:20:30 +00:00
parent cbb9c4f298
commit ed88684e71

View File

@ -450,7 +450,7 @@ class Level implements ChunkManager, Metadatable{
if(!is_array($pk)){
$pk = [$pk];
}
if(!empty($pk)){
if($players === null){
foreach($pk as $e){
$this->broadcastPacketToViewers($sound, $e);
@ -459,13 +459,14 @@ class Level implements ChunkManager, Metadatable{
$this->server->batchPackets($players, $pk, false);
}
}
}
public function addParticle(Particle $particle, array $players = null){
$pk = $particle->encode();
if(!is_array($pk)){
$pk = [$pk];
}
if(!empty($pk)){
if($players === null){
foreach($pk as $e){
$this->broadcastPacketToViewers($particle, $e);
@ -474,6 +475,7 @@ class Level implements ChunkManager, Metadatable{
$this->server->batchPackets($players, $pk, false);
}
}
}
/**
* Broadcasts a LevelEvent to players in the area. This could be sound, particles, weather changes, etc.