Add potion effect

Discussion in 'Plugin Development' started by joby890, Nov 10, 2012.

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

    joby890

    Hey,

    This i though used to work,
    Code:
    public void OnRespawn(PlayerRespawnEvent event) {
    Player p = event.getPlayer();
    p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4000, 1), true);
    }
    i did cut out some of the code. My problem it dosent give the potion effect
     
  2. Offline

    thehutch

    This is from the Javadocs, there is apparently an apply method now :D

    boolean apply(LivingEntity entity)
    Attempts to add the effect represented by this object to the given LivingEntity.
     
  3. Offline

    joby890

    Thanks will try now. ;)

    if (p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4000, 1), true)) {
    log.info("It WORKED");
    } else {
    log.info("It no WORKED");
    }
    This what i tryed and it still didn't work

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  4. Offline

    david_rosales

    Dont add true at the end.
     
    Liutenantpickle likes this.
Thread Status:
Not open for further replies.

Share This Page