Removing potion effects

Discussion in 'Plugin Development' started by Forseth11, Oct 8, 2013.

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

    Forseth11

    I know this has been asked before but I still cant get it. How do I remove potion effects.

    I used 4 different methods and now I'm stuck.

    I'm currently using:
    Code:java
    1. p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 0, 0),true);
    2. p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 0, 0),true);
    3. p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 0, 0),true);
    4. p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 0, 0),true);
    5. p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 0, 0),true);
    6. p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 0, 0),true);
    7. p.addPotionEffect(new PotionEffect(PotionEffectType.HARM, 0, 0),true);
    8. p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 0, 0),true);
    9. p.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 0, 0),true);
    10. p.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 0, 0),true);
    11. p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 0, 0),true);
    12. p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 0, 0),true);
    13. p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 0, 0),true);
    14. p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 0, 0),true);
    15. p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 0, 0),true);
    16. p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 0, 0),true);
    17. p.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 0, 0),true);
    18. p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 0, 0),true);
    19. p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 0, 0),true);
    20. p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 0, 0),true);
    21. p.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 0, 0),true);
    22. p.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 0, 0),true);
    23. p.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 0, 0),true);


    But that does not work.
     
  2. Offline

    Harmings

    To clear a certain potion effect you can use this:
    Code:java
    1. p.removePotionEffect(PotionEffectType.[whatever effect]);

    to remove all a players potion effects you can use this:

    Code:java
    1. for (PotionEffect effect : p.getActivePotionEffects()){
    2. p.removePotionEffect(effect.getType());
     
    zzienzz likes this.
  3. Offline

    Forseth11

    Harmings I have tried those both and neither worked.

    Can someone please help.

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

    JPG2000

Thread Status:
Not open for further replies.

Share This Page