diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 4b306b075..f271351c0 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -493,6 +493,9 @@ abstract class Entity{ } public function attack(EntityDamageEvent $source) : void{ + if($this->isFireProof() && ($source->getCause() === EntityDamageEvent::CAUSE_FIRE || $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK)){ + $source->cancel(); + } $source->call(); if($source->isCancelled()){ return; diff --git a/src/entity/effect/EffectManager.php b/src/entity/effect/EffectManager.php index 939e34bff..747662dc7 100644 --- a/src/entity/effect/EffectManager.php +++ b/src/entity/effect/EffectManager.php @@ -82,14 +82,11 @@ class EffectManager{ $index = spl_object_id($effectType); if(isset($this->effects[$index])){ $effect = $this->effects[$index]; - $hasExpired = $effect->hasExpired(); $ev = new EntityEffectRemoveEvent($this->entity, $effect); $ev->call(); if($ev->isCancelled()){ - if($hasExpired && !$ev->getEffect()->hasExpired()){ //altered duration of an expired effect to make it not get removed - foreach($this->effectAddHooks as $hook){ - $hook($ev->getEffect(), true); - } + foreach($this->effectAddHooks as $hook){ + $hook($ev->getEffect(), true); } return; }