Added correct handling of RemovePlayer packet for in-game player list

This commit is contained in:
Shoghi Cervantes
2013-08-20 01:42:45 +02:00
parent d26d657b95
commit 7102787aa9
4 changed files with 118 additions and 33 deletions

View File

@@ -589,12 +589,12 @@ class Entity extends Position{
if(!($player instanceof Player)){
$player = $this->server->api->player->get($player);
}
if($player->eid === $this->eid or $this->closed !== false or $player->level !== $this->level){
if($player->eid === $this->eid or $this->closed !== false or ($player->level !== $this->level and $this->class !== ENTITY_PLAYER)){
return false;
}
switch($this->class){
case ENTITY_PLAYER:
if($this->player->connected !== true){
if($this->player->connected !== true or $this->spawned === false){
return false;
}
$player->dataPacket(MC_ADD_PLAYER, array(
@@ -922,16 +922,14 @@ class Entity extends Position{
$this->updateMetadata();
$this->dead = true;
if($this->player instanceof Player){
$x = $this->x;
$y = $this->y;
$z = $this->z;
$this->x = 0;
$this->y = -10;
$this->z = 0;
$this->server->api->trigger("entity.move", $this);
$this->x = $x;
$this->y = $y;
$this->z = $z;
$this->server->api->player->broadcastPacket($this->server->api->player->getAll($this->level), MC_MOVE_ENTITY_POSROT, array(
"eid" => $this->eid,
"x" => -256,
"y" => 128,
"z" => -256,
"yaw" => 0,
"pitch" => 0,
));
}else{
$this->server->api->dhandle("entity.event", array("entity" => $this, "event" => 3)); //Entity dead
}