mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +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){
|
||||
if(count($this->effects) > 0){
|
||||
foreach($this->effects as $effect){
|
||||
if($effect->canTick()){
|
||||
$effect->applyEffect($this);
|
||||
}
|
||||
foreach($this->effects as $effect){
|
||||
if($effect->canTick()){
|
||||
$effect->applyEffect($this);
|
||||
}
|
||||
|
||||
$duration = $effect->getDuration() - $tickDiff;
|
||||
if($duration <= 0){
|
||||
$this->removeEffect($effect->getId());
|
||||
}else{
|
||||
$effect->setDuration($duration);
|
||||
}
|
||||
$duration = $effect->getDuration() - $tickDiff;
|
||||
if($duration <= 0){
|
||||
$this->removeEffect($effect->getId());
|
||||
}else{
|
||||
$effect->setDuration($duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user