package net.crankedpvp.bosses.abilities; import net.crankedpvp.bosses.struct.Boss; import net.crankedpvp.bosses.struct.BossAbility; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; public class Launch extends BossAbility { @Override public String getName() { return "Launch"; } @Override protected void abilityEffect(Boss boss, LivingEntity bossEntity, Player player) { bossEntity.getNearbyEntities(6D, 6D, 6D).stream() .filter(entity -> entity instanceof Player) .map(entity -> (Player)entity) .forEach(loopPlayer -> { Location loc = loopPlayer.getLocation().add(0.0, 6.0, 0.0); loopPlayer.setVelocity(loopPlayer.getVelocity().add(loopPlayer.getLocation().toVector().subtract(loc.toVector()).normalize().multiply(3))); loopPlayer.playSound(loopPlayer.getLocation(), Sound.BAT_TAKEOFF, 2.0F, 4.0F); }); } @Override public int getCooldownLength() { return 15; } @Override public double procChance() { return 20; } }