mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Added correct handling of RemovePlayer packet for in-game player list
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user