mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-09 11:31:49 +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{
|
public function removeEffect(int $effectId) : void{
|
||||||
if(isset($this->effects[$effectId])){
|
if(isset($this->effects[$effectId])){
|
||||||
$effect = $this->effects[$effectId];
|
$effect = $this->effects[$effectId];
|
||||||
|
$hasExpired = $effect->hasExpired();
|
||||||
$this->server->getPluginManager()->callEvent($ev = new EntityEffectRemoveEvent($this, $effect));
|
$this->server->getPluginManager()->callEvent($ev = new EntityEffectRemoveEvent($this, $effect));
|
||||||
if($ev->isCancelled()){
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user