From 26516699c7b38c8121ca458a4d6b71f6dafcfdc5 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 17 Jul 2025 13:53:33 +0300 Subject: [PATCH] fixed some players being invisible if they join while other players are joining --- src/API/EntityAPI.php | 4 ++-- src/API/PlayerAPI.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/API/EntityAPI.php b/src/API/EntityAPI.php index 049fbbe2..002220a8 100644 --- a/src/API/EntityAPI.php +++ b/src/API/EntityAPI.php @@ -215,8 +215,8 @@ class EntityAPI{ public function spawnToAll(Entity $e){ foreach($this->server->api->player->getAll($e->level) as $player){ - if($player->eid != false and $player->eid != $e->eid and $e->class != ENTITY_PLAYER and $e instanceof Entity){ - if($e->closed !== false or ($player->level !== $e->level and $e->class !== ENTITY_PLAYER)){ + if($player->spawned && $player->eid != false && $player->eid != $e->eid && $e->class != ENTITY_PLAYER && $e instanceof Entity){ + if($e->closed !== false || ($player->level !== $e->level && $e->class !== ENTITY_PLAYER)){ return false; } diff --git a/src/API/PlayerAPI.php b/src/API/PlayerAPI.php index 4ea9b42a..5ffaa4a1 100644 --- a/src/API/PlayerAPI.php +++ b/src/API/PlayerAPI.php @@ -497,7 +497,7 @@ class PlayerAPI{ public function spawnToAllPlayers(Player $player){ foreach($this->getAll() as $p){ - if($p !== $player and ($p->entity instanceof Entity) and ($player->entity instanceof Entity)){ + if($p->spawned && $p !== $player && ($p->entity instanceof Entity) && ($player->entity instanceof Entity)){ $player->entity->spawn($p); if($p->level !== $player->level){ $pk = new MoveEntityPacket_PosRot;