<commit_before>package land.face.strife.data.effects;

import land.face.strife.data.StrifeMob;
import land.face.strife.stats.StrifeStat;
import land.face.strife.util.DamageUtil;
import land.face.strife.util.LogUtil;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffectType;

public class PotionEffectAction extends Effect {

  private PotionEffectType potionEffectType;
  private double duration;
  private int intensity;
  private boolean bumpUpToIntensity;
  private boolean strictDuration;

  @Override
  public void apply(StrifeMob caster, StrifeMob target) {
    double duration = this.duration;
    if (!strictDuration) {
      duration *= 1 + caster.getStat(StrifeStat.EFFECT_DURATION) / 100;
    }
    if (bumpUpToIntensity) {
      bumpPotionEffect(caster.getEntity(), target.getEntity(), duration);
      return;
    }
    DamageUtil.applyPotionEffect(target.getEntity(), potionEffectType, intensity, (int) duration);
  }

  private void bumpPotionEffect(LivingEntity caster, LivingEntity target, double duration) {
    LogUtil.printDebug(" Bumping potion effect");
    int level = 0;
    if (target.hasPotionEffect(potionEffectType)) {
      level = target.getPotionEffect(potionEffectType).getAmplifier();
      level = Math.min(level + 1, intensity);
      LogUtil.printDebug(" Bumped from " + level + " to " + (level+1) + ". MAX: " + intensity);
    } else {
      LogUtil.printDebug(" Target missing potion effect - adding at intensity 0");
    }
    DamageUtil.applyPotionEffect(target, potionEffectType, level, (int) duration);
  }

  public void setPotionEffectType(PotionEffectType potionEffectType) {
    this.potionEffectType = potionEffectType;
  }

  public void setDuration(double duration) {
    this.duration = duration;
  }

  public void setIntensity(int intensity) {
    this.intensity = intensity;
  }

  public void setStrictDuration(boolean strictDuration) {
    this.strictDuration = strictDuration;
  }

  public void setBumpUpToIntensity(boolean bumpUpToIntensity) {
    this.bumpUpToIntensity = bumpUpToIntensity;
  }
}
<commit_msg>Handling concurrent potion effects added in 1.15.2<commit_after>package land.face.strife.data.effects;

import land.face.strife.data.StrifeMob;
import land.face.strife.stats.StrifeStat;
import land.face.strife.util.LogUtil;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

public class PotionEffectAction extends Effect {

  private PotionEffectType potionEffectType;
  private double duration;
  private int intensity;
  private boolean bumpUpToIntensity;
  private boolean strictDuration;

  @Override
  public void apply(StrifeMob caster, StrifeMob target) {
    double duration = this.duration;
    if (!strictDuration) {
      duration *= 1 + caster.getStat(StrifeStat.EFFECT_DURATION) / 100;
    }
    if (bumpUpToIntensity) {
      bumpPotionEffect(target.getEntity(), duration);
      return;
    }
    target.getEntity()
        .addPotionEffect(new PotionEffect(potionEffectType, (int) duration, intensity));
  }

  private void bumpPotionEffect(LivingEntity target, double duration) {
    LogUtil.printDebug(" Bumping potion effect");
    int level = 0;
    if (target.hasPotionEffect(potionEffectType)) {
      level = target.getPotionEffect(potionEffectType).getAmplifier();
      level = Math.min(level + 1, intensity);
      LogUtil.printDebug(" Bumped from " + level + " to " + (level + 1) + ". MAX: " + intensity);
    } else {
      LogUtil.printDebug(" Target missing potion effect - adding at intensity 0");
    }
    target.addPotionEffect(new PotionEffect(potionEffectType, (int) duration, level));
  }

  public void setPotionEffectType(PotionEffectType potionEffectType) {
    this.potionEffectType = potionEffectType;
  }

  public void setDuration(double duration) {
    this.duration = duration;
  }

  public void setIntensity(int intensity) {
    this.intensity = intensity;
  }

  public void setStrictDuration(boolean strictDuration) {
    this.strictDuration = strictDuration;
  }

  public void setBumpUpToIntensity(boolean bumpUpToIntensity) {
    this.bumpUpToIntensity = bumpUpToIntensity;
  }
}

{'fraction_non_alphanumeric': 0.09625923278532285, 'fraction_numerical': 0.004765308553728854, 'mean_word_length': 4.2278953922789535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3109901', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1276, 'n_words': 279}