<commit_before>package info.faceland.strife.util;

import info.faceland.strife.StrifePlugin;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Arrow.PickupStatus;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.ShulkerBullet;
import org.bukkit.entity.WitherSkull;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;

public class ProjectileUtil {

  public final static String ATTACK_SPEED_META = "AS_MULT";
  public final static String SNEAK_ATTACK_META = "SNEAK_SHOT";

  public static void createMagicMissile(Player shooter, double attackMult, double power,
      double xOff, double yOff, double zOff) {
    createMagicMissile(shooter, attackMult, power, xOff, yOff, zOff, true);
  }

  public static void createMagicMissile(Player shooter, double attackMult, double power,
      double xOff, double yOff, double zOff, boolean gravity) {
    ShulkerBullet magicProj = shooter.getWorld()
        .spawn(shooter.getEyeLocation().clone().add(0, -0.5, 0), ShulkerBullet.class);
    magicProj.setShooter(shooter);
    magicProj.setGravity(gravity);

    Vector vec = shooter.getLocation().getDirection();
    xOff = vec.getX() * power + xOff;
    yOff = vec.getY() * power + yOff;
    zOff = vec.getZ() * power + zOff;
    if (gravity) {
      yOff += 0.25;
    }
    magicProj.setVelocity(new Vector(xOff, yOff, zOff));
    setProjctileAttackSpeedMeta(magicProj, attackMult);
    if (shooter.isSneaking()) {
      setProjectileSneakMeta(magicProj);
    }
  }

  public static void createGhastBall(LivingEntity shooter, double attackMult, double power,
      double radius) {
    shooter.getWorld().playSound(shooter.getLocation(), Sound.ENTITY_GHAST_SHOOT, 0.7f, 1.1f);
    Fireball fireball = shooter.getWorld()
        .spawn(shooter.getEyeLocation().clone().add(0, -0.5, 0), Fireball.class);
    fireball.setShooter(shooter);
    fireball.setBounce(false);
    fireball.setIsIncendiary(false);
    fireball.setYield((float) (2 + radius * 0.5));

    Vector vec = shooter.getLocation().getDirection().multiply(0.05 * power);
    fireball.setVelocity(vec);
    setProjctileAttackSpeedMeta(fireball, attackMult);
  }

  public static void createWitherSkull(LivingEntity shooter, double attackMult, double power,
      double radius) {
    shooter.getWorld().playSound(shooter.getLocation(), Sound.ENTITY_WITHER_SHOOT, 0.7f, 1.1f);
    WitherSkull skull = shooter.getWorld()
        .spawn(shooter.getEyeLocation().clone().add(0, -0.5, 0), WitherSkull.class);
    skull.setShooter(shooter);
    skull.setYield((float) (2 + radius * 0.5));

    Vector vec = shooter.getLocation().getDirection().multiply(0.05 * power);
    skull.setVelocity(vec);
    setProjctileAttackSpeedMeta(skull, attackMult);
  }

  public static void createArrow(Player shooter, double attackMult, double power, double xOff,
      double yOff, double zOff) {
    createArrow(shooter, attackMult, power, xOff, yOff, zOff, true);
  }

  public static void createArrow(Player shooter, double attackMult, double power,
      double xOff, double yOff, double zOff, boolean gravity) {
    Arrow arrow = shooter.getWorld().spawn(shooter.getLocation(), Arrow.class);
    arrow.setShooter(shooter);
    arrow.setPickupStatus(PickupStatus.CREATIVE_ONLY);
    arrow.setGravity(gravity);

    Vector vector = shooter.getLocation().getDirection();
    xOff = vector.getX() * power + xOff;
    yOff = vector.getY() * power + yOff;
    zOff = vector.getZ() * power + zOff;
    if (gravity) {
      yOff += 0.19;
    }
    arrow.setVelocity(new Vector(xOff, yOff, zOff));<commit_msg>Projectile quality of life changes<commit_after>package info.faceland.strife.util;

import info.faceland.strife.StrifePlugin;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.ShulkerBullet;
import org.bukkit.entity.WitherSkull;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;

//import org.bukkit.entity.Arrow.PickupStatus;

public class ProjectileUtil {

  public final static String ATTACK_SPEED_META = "AS_MULT";
  public final static String SNEAK_ATTACK_META = "SNEAK_SHOT";

  public static void createMagicMissile(Player shooter, double attackMult, double power,
      double xOff, double yOff, double zOff) {
    createMagicMissile(shooter, attackMult, power, xOff, yOff, zOff, true);
  }

  public static void createMagicMissile(Player shooter, double attackMult, double power,
      double xOff, double yOff, double zOff, boolean gravity) {
    ShulkerBullet magicProj = shooter.getWorld().spawn(
        shooter.getEyeLocation().clone().add(0, -0.35, 0), ShulkerBullet.class);
    magicProj.setShooter(shooter);
    magicProj.setGravity(gravity);

    Vector vec = shooter.getEyeLocation().getDirection();
    xOff = vec.getX() * power + xOff;
    yOff = vec.getY() * power + yOff;
    zOff = vec.getZ() * power + zOff;
    if (gravity) {
      yOff += 0.23;
    }
    magicProj.setVelocity(new Vector(xOff, yOff, zOff));
    setProjctileAttackSpeedMeta(magicProj, attackMult);
    if (shooter.isSneaking()) {
      setProjectileSneakMeta(magicProj);
    }
  }

  public static void createGhastBall(LivingEntity shooter, double attackMult, double power,
      double radius) {
    shooter.getWorld().playSound(shooter.getLocation(), Sound.ENTITY_GHAST_SHOOT, 0.7f, 1.1f);
    Fireball fireball = shooter.getWorld()
        .spawn(shooter.getEyeLocation().clone().add(0, -0.35, 0), Fireball.class);
    fireball.setShooter(shooter);
    fireball.setBounce(false);
    fireball.setIsIncendiary(false);
    fireball.setYield((float) (2 + radius * 0.5));

    Vector vec = shooter.getLocation().getDirection().multiply(0.05 * power);
    fireball.setVelocity(vec);
    setProjctileAttackSpeedMeta(fireball, attackMult);
  }

  public static void createWitherSkull(LivingEntity shooter, double attackMult, double power,
      double radius) {
    shooter.getWorld().playSound(shooter.getLocation(), Sound.ENTITY_WITHER_SHOOT, 0.7f, 1.1f);
    WitherSkull skull = shooter.getWorld().spawn(
        shooter.getEyeLocation().clone().add(0, -0.35, 0), WitherSkull.class);
    skull.setShooter(shooter);
    skull.setYield((float) (2 + radius * 0.5));

    Vector vec = shooter.getLocation().getDirection().multiply(0.05 * power);
    skull.setVelocity(vec);
    setProjctileAttackSpeedMeta(skull, attackMult);
  }

  public static void createArrow(Player shooter, double attackMult, double power, double xOff,
      double yOff, double zOff) {
    createArrow(shooter, attackMult, power, xOff, yOff, zOff, true);
  }

  public static void createArrow(Player shooter, double attackMult, double power,
      double xOff, double yOff, double zOff, boolean gravity) {
    Arrow arrow = shooter.getWorld().spawn(
        shooter.getEyeLocation().clone().add(0, -0.35, 0), Arrow.class);
    arrow.setShooter(shooter);
    //arrow.setPickupStatus(PickupStatus.CREATIVE_ONLY);
    arrow.setGravity(gravity);

    Vector vector = shooter.getEyeLocation().getDirection();
    xOff = vector.getX() * power + xOff;
    yOff = vector.getY() * power + yOff;
    zOff = vector.getZ() * power + zOff;
    if (gravity) {
      yOff += 0.17;
    }
    arrow.setVelocity(new Vector(xOff, yOff, zOff));
{'fraction_non_alphanumeric': 0.12226957911561001, 'fraction_numerical': 0.011188066062866276, 'mean_word_length': 4.182194616977226, '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': '415195', 'n_tokens_mistral': 2674, 'n_tokens_neox': 2496, 'n_words': 518}