diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index a0eb81597..2026d655f 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2119,6 +2119,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ } public function kill(){ + if($this->dead or $this->spawned === false){ + return; + } parent::kill(); $message = $this->getName() ." died"; $cause = $this->getLastDamageCause(); diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 0b2fd4c8b..29c0ee3b2 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -957,6 +957,9 @@ abstract class Entity extends Position implements Metadatable{ } public function kill(){ + if($this->dead){ + return; + } $this->setHealth(0); $this->dead = true; $this->scheduleUpdate(); diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index 0b9b3a9af..8d3e25ec8 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -84,6 +84,9 @@ abstract class Living extends Entity implements Damageable{ } public function kill(){ + if($this->dead){ + return; + } parent::kill(); $this->server->getPluginManager()->callEvent($ev = new EntityDeathEvent($this, $this->getDrops())); foreach($ev->getDrops() as $item){