From 2e0ef645fa1ec220f4d6c5ef875a02f1468488e1 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Wed, 5 Aug 2015 13:40:11 +0200 Subject: [PATCH] Fixed several issues with spawning/despawning Players/Humans, close #3345, close #3342 --- src/pocketmine/entity/Human.php | 14 +++++--------- .../level/particle/FloatingTextParticle.php | 2 -- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 5389f4f2d..2d3d62ffa 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -222,7 +222,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ if(!($this instanceof Player)){ - $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->isSlim, $this->skin, $player); + $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->isSlim, $this->skin, [$player]); } $pk = new AddPlayerPacket(); @@ -237,18 +237,14 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ $pk->speedZ = $this->motionZ; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; - $item = $this->getInventory()->getItemInHand(); - $pk->item = $item->getId(); - $pk->meta = $item->getDamage(); - $pk->skin = $this->skin; - $pk->slim = $this->isSlim; + $pk->item = $this->getInventory()->getItemInHand(); $pk->metadata = $this->dataProperties; $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING)); $this->inventory->sendArmorContents($player); if(!($this instanceof Player)){ - $this->server->removePlayerListData($this->getUniqueId(), $player); + $this->server->removePlayerListData($this->getUniqueId(), [$player]); } } } @@ -257,8 +253,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ if(isset($this->hasSpawned[$player->getLoaderId()])){ $pk = new RemovePlayerPacket(); - $pk->eid = $this->getUniqueId(); - $pk->clientID = $this->getId(); + $pk->eid = $this->getId(); + $pk->clientId = $this->getUniqueId(); $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING)); unset($this->hasSpawned[$player->getLoaderId()]); } diff --git a/src/pocketmine/level/particle/FloatingTextParticle.php b/src/pocketmine/level/particle/FloatingTextParticle.php index f5aa7a7a0..c25fea661 100644 --- a/src/pocketmine/level/particle/FloatingTextParticle.php +++ b/src/pocketmine/level/particle/FloatingTextParticle.php @@ -25,9 +25,7 @@ use pocketmine\entity\Entity; use pocketmine\entity\Item as ItemEntity; use pocketmine\math\Vector3; use pocketmine\network\protocol\AddEntityPacket; -use pocketmine\network\protocol\AddPlayerPacket; use pocketmine\network\protocol\RemoveEntityPacket; -use pocketmine\network\protocol\RemovePlayerPacket; class FloatingTextParticle extends Particle{ //TODO: HACK!