Solved Will an error be thrown?

Discussion in 'Plugin Development' started by RoboticPlayer, Oct 25, 2015.

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

    RoboticPlayer

    Just wondering if an error will be thrown if you try to remove a potion effect that the player does not have. For example:
    Code:
    Player p = (Player) sender;
    
    p.removePotionEffect(PotionEffectType.BLINDNESS);
    If the player doesn't have the blindness effect when that is called, will there be an error or will just nothing happen?
     
  2. Test it yourself
     
  3. Offline

    SuperSniper

    @henderry2019 I don't think so, but you might wanna check if the player actually has that active potion effect first, just in case.
     
  4. Offline

    Xerox262

    Agreed, it doesn't hurt to check, also means if anything changes and errors start getting thrown he'd be covered.
     
  5. Offline

    DoggyCode™

    No error will be thrown... And you don't have to check. The method checks it for you I believe.
     
  6. Offline

    teej107

    I think
    will be much more effective.

    But I can tell you that it won't throw an error if the LivingEntity doesn't have the effect.
     
  7. Offline

    RoboticPlayer

Thread Status:
Not open for further replies.

Share This Page