Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

setAmplifier in effect

Comments in 'Plugin Development' started by deot, Oct 30, 2015.

  1. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    Code:
                $effect = Effect::REGENERATION;
                $effect->setAmplifier(0);
    This is my code to set amplifier to an effect.. What's wrong with it?

    Error code I got:
    INFO Fatal error: Call to a member function setAmplifier() on integer in phar:///plugins/MDCore.phar/src/Core/Core.php on line 204

    Integer error?? I think there's 0 for amplifier for effect... isn't? Or I need to fill 1?
  2. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    $effect = Effect::getEffect(Effect::REGENERATION);
    PEMapModder, CraftYourBukkit and deot like this.
  3. CavinMiana
    Offline

    CavinMiana Active Member

    Joined:
    Aug 26, 2015
    Posts:
    101
    Minecraft User:
    CavinMiana
    Add setDuration(?);
  4. Kripak
    Offline

    Kripak New Member

    Joined:
    Jul 17, 2015
    Posts:
    45
    Minecraft User:
    Kripak
    For effects use this:
    Code:
           $effect = Effect::getEffect(id regeneration);
           $effect->setVisible(true);
           $effect->setAmplifier(for e.g 1);
           $effect->setDuration(for e.g 1);
           $p->addEffect($effect);
  5. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    True is the default form in a string, so therefore, it is not necessary to utilise "(true)", you can also use:
    PHP:
    setVisible();
  6. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    function*

Share This Page

Advertisement