pocketmine\item\Potion::getEffectsById PHP Method

getEffectsById() public static method

public static getEffectsById ( integer $id ) : array
$id integer
return array
    public static function getEffectsById(int $id) : array
    {
        if (count(self::POTIONS[$id]) === 3) {
            return [Effect::getEffect(self::POTIONS[$id][0])->setDuration(self::POTIONS[$id][1])->setAmplifier(self::POTIONS[$id][2])];
        }
        return [];
    }

Usage Example

Esempio n. 1
0
 public function kill()
 {
     $color = Potion::getColor($this->getPotionId());
     $this->getLevel()->addParticle(new SpellParticle($this, $color[0], $color[1], $color[2]));
     $players = $this->getViewers();
     foreach ($players as $p) {
         if ($p->distance($this) <= 6) {
             foreach (Potion::getEffectsById($this->getPotionId()) as $effect) {
                 $p->addEffect($effect);
             }
         }
     }
     parent::kill();
 }
All Usage Examples Of pocketmine\item\Potion::getEffectsById