Solved Help with player.addPotionEffect

Discussion in 'Spigot Plugin Development' started by Dartanman, May 30, 2016.

Thread Status:
Not open for further replies.
  1. Here's the code of

    Yes, the event is registered. The only problem is "player.addPotionEffect" is underlined in red. When I hover over it (Eclipse), it says

    "The method addPotionEffect(PotionEffect, boolean) in the type LivingEntity is not applicable for the arguments (PotionEffectType, int, int)"

    What am I doing wrong?
  2. Try saving the file, closing it and reopening. If that doesn't work, cut all code, delete the class, and put it in a new class. Eclipse has fun throwing errors when you actually don't have any.

    EDIT: Look below, didn't realize you were missing the PotionEffect constructor.
  3. Try: player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 10));
  4. Giving you error because really bad the code, use the following:
    Code (Text):
    player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 10), true);
  5. Thanks guys! I can't believe I did that... XD
Thread Status:
Not open for further replies.