pocketmine\event\entity\EntityDamageEvent::isApplicable PHP Method

isApplicable() public method

public isApplicable ( integer $type ) : boolean
$type integer
return boolean
    public function isApplicable($type)
    {
        return isset($this->modifiers[$type]);
    }

Usage Example

 /**
  * @param EntityDamageEvent $event
  * @priority LOWEST
  */
 public function onDamage(EntityDamageEvent $event)
 {
     if ($event->isApplicable(EntityDamageEvent::MODIFIER_ARMOR) and ($damage = $event->getDamage(EntityDamageEvent::MODIFIER_ARMOR)) > 0) {
         $event->setDamage(-floor($event->getDamage() * 0.04 * $damage), EntityDamageEvent::MODIFIER_ARMOR);
     }
 }
All Usage Examples Of pocketmine\event\entity\EntityDamageEvent::isApplicable