mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Living: fixed preventing effect expiry using events, closes #2208
This commit is contained in:
parent
87ff1c0382
commit
74c0863905
@ -200,8 +200,12 @@ abstract class Living extends Entity implements Damageable{
|
||||
public function removeEffect(int $effectId) : void{
|
||||
if(isset($this->effects[$effectId])){
|
||||
$effect = $this->effects[$effectId];
|
||||
$hasExpired = $effect->hasExpired();
|
||||
$this->server->getPluginManager()->callEvent($ev = new EntityEffectRemoveEvent($this, $effect));
|
||||
if($ev->isCancelled()){
|
||||
if($hasExpired and !$ev->getEffect()->hasExpired()){ //altered duration of an expired effect to make it not get removed
|
||||
$this->sendEffectAdd($ev->getEffect(), true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user