Added API method Living::hasEffects() (#2054)

This commit is contained in:
Oreo Oreoniv 2018-02-24 16:48:15 +03:00 committed by Dylan K. Taylor
parent e5ec8fa603
commit 2b036b1a5c

View File

@ -233,6 +233,14 @@ abstract class Living extends Entity implements Damageable{
return isset($this->effects[$effectId]); return isset($this->effects[$effectId]);
} }
/**
* Returns whether the mob has any active effects.
* @return bool
*/
public function hasEffects() : bool{
return !empty($this->effects);
}
/** /**
* Adds an effect to the mob. * Adds an effect to the mob.
* If a weaker effect of the same type is already applied, it will be replaced. * If a weaker effect of the same type is already applied, it will be replaced.