pocketmine\entity\Effect::getEffect PHP Method

getEffect() public static method

public static getEffect ( integer $id )
$id integer
    public static function getEffect($id)
    {
        if (isset(self::$effects[$id])) {
            return clone self::$effects[(int) $id];
        }
        return null;
    }

Usage Example

Example #1
1
 public function onPlayerMove(PlayerMoveEvent $event)
 {
     $player = $event->getPlayer();
     $world = $player->getLevel();
     $block = $world->getBlock($player->floor()->subtract(0, 1));
     if ($world->getName() == $this->getHotBlock()->getConfig()->get("world")) {
         switch ($block->getId()) {
             case Block::PLANKS:
                 $player->sendTip("§aYou're safe!");
                 break;
             case Block::END_STONE:
                 $player->sendTip("§eGo!");
                 break;
             case Block::NETHERRACK:
                 $player->sendTip("§cYou'll poisoned!");
                 $effect = Effect::getEffect(Effect::POISON);
                 $effect->setVisible(true);
                 $effect->setDuration(50);
                 $player->addEffect($effect);
                 break;
             case Block::QUARTZ_BLOCK:
                 if (count($world->getPlayers()) < $this->getHotBlock()->getConfig()->get("players")) {
                     $player->sendTip("§cThere must be " . $this->getHotBlock()->getConfig()->get("players") . "players online");
                 } else {
                     $player->sendTip("§eYou're standing on the §l§cHot§6Block§r§e! §bMove!");
                     $this->getHotBlock()->getEconomy()->addMoney($player, 1, false, "HotBlock");
                     $player->sendPopup("§eYou have §a" . $this->getHotBlock()->getEconomy()->myMoney($player) . " §bCoins");
                 }
                 break;
         }
     }
 }
All Usage Examples Of pocketmine\entity\Effect::getEffect