Merge branch 'next-minor' into next-major

This commit is contained in:
Dylan K. Taylor 2022-07-14 19:54:50 +01:00
commit d4f4fda442
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 5 additions and 5 deletions

View File

@ -493,6 +493,9 @@ abstract class Entity{
} }
public function attack(EntityDamageEvent $source) : void{ public function attack(EntityDamageEvent $source) : void{
if($this->isFireProof() && ($source->getCause() === EntityDamageEvent::CAUSE_FIRE || $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK)){
$source->cancel();
}
$source->call(); $source->call();
if($source->isCancelled()){ if($source->isCancelled()){
return; return;

View File

@ -82,14 +82,11 @@ class EffectManager{
$index = spl_object_id($effectType); $index = spl_object_id($effectType);
if(isset($this->effects[$index])){ if(isset($this->effects[$index])){
$effect = $this->effects[$index]; $effect = $this->effects[$index];
$hasExpired = $effect->hasExpired();
$ev = new EntityEffectRemoveEvent($this->entity, $effect); $ev = new EntityEffectRemoveEvent($this->entity, $effect);
$ev->call(); $ev->call();
if($ev->isCancelled()){ 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){
foreach($this->effectAddHooks as $hook){ $hook($ev->getEffect(), true);
$hook($ev->getEffect(), true);
}
} }
return; return;
} }