Potion effects keep removing

Discussion in 'Spigot Plugin Development' started by Kingbluesapphire, Jul 22, 2018.

  1. I am working on a Spigot plugin and have it so there is a chance of poison being removed. The problem is when I remove the effect they aren't able to be poisoned again until they relog.

    I remove the effect using

    Code (Java):
    for(PotionEffect effect : user.getPlayer().getActivePotionEffects())
                    if(effect.getType().equals(PotionEffectType.POISON))
                        user.getPlayer().removePotionEffect(effect.getType());
                user.sendMessage(Prefix.skill, "Poison effect has been removed!");
                return;
    It messages the user everytime the effect is being remove so I know the code isn't being run all the time but once I remove the effect they aren't able to get it again, what am I doing wrong?
     
  2. md_5

    Administrator Developer

    Version?
     
  3. It doesn't, you need to add curly brackets to wrap your if statement and anything you want in him
     
  4. spigot-1.8.8-R0.1-SNAPSHOT-latest

    I added the bracket and it still only sends the message once and they still can't regain the potion effect.
     
  5. md_5

    Administrator Developer

    Could be a bug in that version, who knows.
    Hasn't been updated for like 3 years
     
    • Agree Agree x 1
  6. Is there another way to remove potion effects?
    I tried with
    Code (Java):
    addPotionEffect(new PotionEffect(PotionEffectType.POISON, 0, 0, true));
    but it doesn't do anything.
     
  7. I tried to do it but Poison potion effect seems bugged because I can easily remove a night_vision effect the same way
     
    • Agree Agree x 1