mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 23:15:29 +00:00
Remove redundant count() for effects ticking
This commit is contained in:
parent
e9951b1b1f
commit
c5ac6a7606
@ -484,18 +484,16 @@ abstract class Living extends Entity implements Damageable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function doEffectsTick(int $tickDiff = 1){
|
protected function doEffectsTick(int $tickDiff = 1){
|
||||||
if(count($this->effects) > 0){
|
foreach($this->effects as $effect){
|
||||||
foreach($this->effects as $effect){
|
if($effect->canTick()){
|
||||||
if($effect->canTick()){
|
$effect->applyEffect($this);
|
||||||
$effect->applyEffect($this);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$duration = $effect->getDuration() - $tickDiff;
|
$duration = $effect->getDuration() - $tickDiff;
|
||||||
if($duration <= 0){
|
if($duration <= 0){
|
||||||
$this->removeEffect($effect->getId());
|
$this->removeEffect($effect->getId());
|
||||||
}else{
|
}else{
|
||||||
$effect->setDuration($duration);
|
$effect->setDuration($duration);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user