Fixed several issues with spawning/despawning Players/Humans, close #3345, close #3342

This commit is contained in:
Shoghi Cervantes 2015-08-05 13:40:11 +02:00
parent 09720a2d90
commit 2e0ef645fa
2 changed files with 5 additions and 11 deletions

View File

@ -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()]);
}

View File

@ -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!