How can I add a effect to a command?

Discussion in 'Plugin Help' started by RoccoYT, Oct 28, 2019.

  1. RoccoYT

    RoccoYT Spider

    Messages:
    13
    GitHub:
    RoccoTheDev
    What's here the mistake or what is another option to add an effect to an player for 600 seconds with amplification 4?
     

    Attached Files:

  2. HimbeersaftLP

    HimbeersaftLP Chicken

    Messages:
    1,840
    GitHub:
    HimbeersaftLP
    PHP:
    $effect Effect::getEffect(3);
    $duration 600 20// times 20 because it's in ticks
    $amplification 4;
    $effectInstance = new EffectInstance($effect$duration$amplification);
    $player->addEffect($effectInstance);
     
  3. AsponPL

    AsponPL Spider Jockey

    Messages:
    38
    u need to use :

    PHP:
    use pocketmine\entity\Effect;
    use 
    pocketmine\entity\EffectInstance;
    and this code :

    PHP:
    $player->addEffect((new EffectInstance(Effect::getEffect(Effect::REGENERATION)))->setDuration(intval(20*600))->setAmplifier(intval(4)));
     

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.