I’ve noticed that there are several posts on how to add potion effects to players. My questions is, how can one remove potion effects from players? I’ve tried the code below, but it doesn’t work. Thanks!
Optional<PotionEffectData> playerPotionEffects = player.get(PotionEffectData.class);
if(playerPotionEffects.isPresent()){
PotionEffectData potionEffects = playerPotionEffects.get();
for(PotionEffect potionEffect: potionEffects.effects().get()){
player.get(PotionEffectData.class).get().remove(potionEffect);
}
//potionEffects.effects().get().clear();

