@Override public SpellResult perform(CastContext context) { Entity entity = context.getTargetEntity(); if (entity == null || !(entity instanceof LivingEntity)) { return SpellResult.NO_TARGET; } LivingEntity targetEntity = (LivingEntity) entity; Collection<PotionEffect> currentEffects = targetEntity.getActivePotionEffects(); for (PotionEffect effect : currentEffects) { if (negativeEffects.contains(effect.getType())) { context.registerPotionEffects(targetEntity); targetEntity.removePotionEffect(effect.getType()); } } return SpellResult.CAST; }