Merge pull request #3072 from alejandroliu/Kill-entity-bug

Fixes bug #3071
This commit is contained in:
Shoghi Cervantes 2015-05-28 17:34:38 +02:00
commit ce59703dd0

View File

@ -2,11 +2,11 @@
/* /*
* *
* ____ _ _ __ __ _ __ __ ____ * ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@ -15,7 +15,7 @@
* *
* @author PocketMine Team * @author PocketMine Team
* @link http://www.pocketmine.net/ * @link http://www.pocketmine.net/
* *
* *
*/ */
@ -617,7 +617,6 @@ abstract class Entity extends Location implements Metadatable{
if($amount <= 0){ if($amount <= 0){
if($this->isAlive()){ if($this->isAlive()){
$this->health = 0;
$this->kill(); $this->kill();
} }
}elseif($amount <= $this->getMaxHealth() or $amount < $this->health){ }elseif($amount <= $this->getMaxHealth() or $amount < $this->health){
@ -1424,7 +1423,7 @@ abstract class Entity extends Location implements Metadatable{
} }
public function kill(){ public function kill(){
$this->setHealth(0); $this->health = 0;
$this->scheduleUpdate(); $this->scheduleUpdate();
} }