for (dEntity entity : entities) {
if (entity.getLivingEntity().hasPotionEffect(effect))
entity.getLivingEntity().removePotionEffect(effect);
if (remove) continue;
PotionEffect potion = new PotionEffect(effect, duration.getTicksAsInt(), amplifier);
if (!potion.apply(entity.getLivingEntity()))
dB.echoError(scriptEntry.getResidingQueue(), "Bukkit was unable to apply '" + potion.getType().getName() + "' to '" + entity.toString() + "'.");
}
}
}