Наследование: extends EntityCombustEvent
Пример #1
0
 public function onEntityCollide(Entity $entity)
 {
     if (!$entity->hasEffect(Effect::FIRE_RESISTANCE)) {
         $ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
         $entity->attack($ev->getFinalDamage(), $ev);
     }
     $ev = new EntityCombustByBlockEvent($this, $entity, 8);
     if ($entity instanceof Arrow) {
         $ev->setCancelled();
     }
     Server::getInstance()->getPluginManager()->callEvent($ev);
     if (!$ev->isCancelled()) {
         $entity->setOnFire($ev->getDuration());
     }
 }
Пример #2
0
 public function onMove(PlayerMoveEvent $event)
 {
     $blockPos = round($event->getPlayer()->x) . "." . round($event->getPlayer()->y) . "." . round($event->getPlayer()->z);
     if (isset($this->fireblock[$blockPos])) {
         $this->getServer()->getPluginManager()->callEvent($ev = new EntityCombustByBlockEvent(Block::get(Block::FIRE), $event->getPlayer(), 5));
         if (!$ev->isCancelled()) {
             $event->getPlayer()->setOnFire($ev->getDuration());
         }
     }
 }