I can't add effects to a player?

Discussion in 'Plugin Help' started by KingRainbow44, Sep 8, 2019.

  1. KingRainbow44

    KingRainbow44 Creeper

    Messages:
    1
    GitHub:
    kingrainbow44
    I've looked at a few posts from this forum on how to add effects to players. And I keep coming across this line:

    $player->addEffect(Effect::getEffect(10)->setAmplifier(50)->setDuration(20*2)->setVisible(false));

    Problem is, I get this error when attempting to run this line.
    [11:46:13] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\entity\Effect::setAmplifier()" (EXCEPTION) in "plugins/Core/src/Core/Main" at line 216

    I have both the:
    use pocketmine\entity\Effect;
    and the:
    use pocketmine\entity\EffectInstance;

    What is happening??

    Forum posts:
    https://forums.pmmp.io/threads/how-i-add-a-effect-code.5373/
    https://forums.pmmp.io/threads/giving-player-effect-with-amplifier-and-duration.3597/
     
  2. HimbeersaftLP

    HimbeersaftLP Chicken

    Messages:
    1,687
    GitHub:
    HimbeersaftLP

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.