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

Solved Applying Effects Infinitely

Comments in 'Plugin Development' started by Calrizer, Aug 2, 2015.

Thread Status:
Not open for further replies.
  1. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    Hi today I was wonder how to apply potion effects to a player infinitely.
    I have already created a function to apply effects wit a duration of about 40 minutes but I would like to change the duration to infinite. Heres the function:
    PHP:
    public function giveEffects($player){
           
            
    $speed Effect::getEffect(1);
           
            
    $jump Effect::getEffect(8);
           
            
    $speed->setVisible(false);
           
            
    $jump->setVisible(false);
           
            
    $speed->setAmplifier("2");
           
            
    $speed->setDuration(60000); //Change This
           
            
    $jump->setDuration(60000); //Change This
           
            
    $player->addEffect($speed);
           
            
    $player->addEffect($jump);
        }
    Feel free to use this function in your work.
    Any help is appreciated :)
    HotFireyDeath likes this.
  2. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    I've never tried this, but, try to make the setDuration(); time to 1000000. That should simulate an infinite potion effect.
    PEMapModder likes this.
  3. Calrizer
    Offline

    Calrizer Active Member

    Joined:
    Jan 17, 2015
    Posts:
    102
    Minecraft User:
    callumdrain
    I guess it will do for now! :)
    I've been testing things like:
    PHP:
    $effect->setAmbient(true);
    $effect->canTick(false);
    But they don't appear to do anything.
    HotFireyDeath likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Amplifier should be 2 not "2". It is an integer; why make it a string?
Thread Status:
Not open for further replies.

Share This Page

Advertisement