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

Can You Remove Effects On EntityArmorChangeEvent?

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 Want To Setup Where If The Player Puts On A Diffrent Armor Piece except Diamond Armor Its Clears There Effect
    Heres My Code There Are No Errors Or Anything It Dosent Do Anything At All :p
    PHP:
           public function ArmorChange(EntityArmorChangeEvent $ev){
            
    $player $ev->getEntity();
                         
    $effect Effect::getEffect("5");
    $effect->setVisible(false);
    $effect->setAmplifier("2");
    $effect->setDuration("6000");
    if(
    $player instanceof Player){
    if(
    $ev->getNewItem()->getID() === 310){
    $player->addEffect($effect);
                }
            }
            else {
                     
    $player->removeEffect();
                return;
            }
            }
  2. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    removeEffect ($effectId) or removeAllEffects ()

    Go here
    LDX and PEMapModder like this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You have to check if it is between 310 and 313, not just 310.
    Legoboy0215 likes this.

Share This Page

Advertisement