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

How To Give A Player A Effect On PlayerItemHeldEvent?

Comments in 'Plugin Development' started by TryoneLegendZzz, Jul 19, 2015.

  1. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    Ok So I Am Trying To Give A Player A Effecf On PlayerItemHeldEvent And It Dosent Work Here Is The Code
    PHP:
    if($item instanceof Item){
                switch(
    $item->getId()){
                    case 
    278:
                        
    $player->addEffect("10");
                    break;
            }
            }
  2. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    nevermind i got it!
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    addEffect must be passed with an Effect object. Also, you should never use strings for numbers unless you are playing with the bcadd() family functions (which most of us don't need to use it. I have never used it. It is only for processing extremely large numbers).
  4. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    yeah i change that today cause it didnt wrk cause i didnt set the length and amp
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Length and amplitude have default values if you don't set them.

Share This Page

Advertisement