Detecting Potion Effects

I have a few questions about potion effects:

  1. How can I detect if a player has a specific potion, like regeneration:

  2. How can I remove a specific potion from a player:

I belive it is something like

PotionEffectData data = player.getOrCreate(PotionEffectData.class).get();
ListValue<PotionEffect> effects = data.effects();

From there you just manipulate the potion effect data.

Or, for a simpler approach,

List<PotionEffect> effects = player.get(Keys.POTION_EFFECTS).get();
1 Like