Improved EntityRegainHealthEvent

This commit is contained in:
Shoghi Cervantes
2014-10-08 16:28:40 +02:00
parent 4346773e25
commit 7b09edf048
5 changed files with 33 additions and 11 deletions

View File

@ -113,11 +113,7 @@ abstract class Living extends Entity implements Damageable{
$this->setMotion($motion);
}
public function heal($amount){
$this->server->getPluginManager()->callEvent($ev = new EntityRegainHealthEvent($this, $amount));
if($ev->isCancelled()){
return;
}
public function heal($amount, $source = EntityRegainHealthEvent::CAUSE_MAGIC){
$this->setHealth($this->getHealth() + $amount);
}