Ary Dingle

make it so when you press F on ur keyboard it activates the warden sonic boom effect

Kodari AI
KodariOct 27 at 9:55 pm 1
WardenSonicBoom
A Minecraft plugin that triggers the Warden's sonic boom effect when a player presses the F key. The plugin listens for player swap-hand key events, checks cooldowns and permissions, then summons a visual sonic boom attack from the player's position toward their facing direction. Includes configurable damage, range, cooldown, and particle effects, with sound effects and knockback applied to affected entities. Features a config file for tuning all parameters, permission nodes for access control, and a cooldown system to prevent spam. The sonic boom visual uses the Warden's sonic boom particle and sound effects for an authentic experience.
  1. Create a Paper plugin that listens for the F/offhand-swap key.

  2. Cancel the hand swap and fire a Warden-style sonic boom that hits the first living target in its path.

Created the SonicBoom plugin. Pressing F fires a Warden-style sonic boom up to 15 blocks, stops at walls, and deals 10 damage to the first living target hit.

Ary Dingle
  1. can you make it so there is a 10 second cooldown
  2. can you make a charge animation / effect
  3. make a trial that goes to the target location as it only makes an effect at the target location
Kodari AI
KodariOct 27 at 10:02 pm 1
  1. Add a 10-second cooldown to the F-key ability.

  2. Add a visible charging effect before firing.

  3. Animate a sonic-boom trail traveling to the target, with impact effects at the endpoint.

  1. Added a 10-second cooldown with remaining-time feedback.

  2. Added a one-second soul-particle charge effect before firing.

  3. The sonic boom now travels along the ray-traced path and creates its impact effect—and deals damage—at the endpoint.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
3 159
src/main/java/com/example/sonicboom/SonicBoomPlugin.java
package com.example.sonicboom;

import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public final class SonicBoomPlugin extends JavaPlugin implements Listener {
    private static final double RANGE = 15.0;
    private static final double DAMAGE = 10.0;
    private static final long COOLDOWN_MILLIS = 10_000L;
    private final Map<UUID, Long> cooldowns = new HashMap<>();

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onSwapHands(PlayerSwapHandItemsEvent event) {
        event.setCancelled(true);
        startCharge(event.getPlayer());
    }

    private void startCharge(Player player) {
        long now = System.currentTimeMillis();
        long cooldownEnd = cooldowns.getOrDefault(player.getUniqueId(), 0L);
        if (now < cooldownEnd) {
            long secondsRemaining = (cooldownEnd - now + 999) / 1_000;
            player.sendMessage("§cSonic boom is on cooldown for " + secondsRemaining + "s.");
            return;
        }
        cooldowns.put(player.getUniqueId(), now + COOLDOWN_MILLIS);

        new BukkitRunnable() {
            private int elapsedTicks;

            @Override
            public void run() {
                if (!player.isOnline()) {
                    cancel();
                    return;
                }

                Location center = player.getEyeLocation();
                double radius = 0.25 + elapsedTicks * 0.025;
                XParticle.of("SOUL").ifPresent(particle -> {
                    for (int i = 0; i < 6; i++) {
                        double angle = Math.toRadians(elapsedTicks * 18 + i * 60);
                        Location point = center.clone().add(
                                Math.cos(angle) * radius,
                                Math.sin(angle * 0.5) * 0.35,
                                Math.sin(angle) * radius);
                        player.getWorld().spawnParticle(particle.get(), point, 1, 0, 0, 0, 0);
                    }
                });

                elapsedTicks += 2;
                if (elapsedTicks >= 20) {
                    cancel();
                    fireSonicBoom(player);
                }
            }
        }.runTaskTimer(this, 0L, 2L);
    }

    private void fireSonicBoom(Player player) {
        Location origin = player.getEyeLocation();
        Vector direction = origin.getDirection().normalize();
        RayTraceResult blockHit = player.getWorld().rayTraceBlocks(
                origin, direction, RANGE, FluidCollisionMode.NEVER, true);
        RayTraceResult entityHit = player.getWorld().rayTraceEntities(
                origin, direction, RANGE, 0.3, entity -> entity instanceof LivingEntity && entity != player);

        Location impact = origin.clone().add(direction.clone().multiply(RANGE));
        double impactDistance = RANGE;
        if (blockHit != null) {
            impact = blockHit.getHitPosition().toLocation(player.getWorld());
            impactDistance = origin.distance(impact);
        }

        LivingEntity target = null;
        if (entityHit != null) {
            Location entityImpact = entityHit.getHitPosition().toLocation(player.getWorld());
            if (origin.distance(entityImpact) <= impactDistance) {
                impact = entityImpact;
                target = (LivingEntity) entityHit.getHitEntity();
            }
        }

        final Location start = origin.clone();
        final Location effectLocation = impact.clone();
        final Vector path = effectLocation.toVector().subtract(start.toVector());
        final LivingEntity hitTarget = target;
        final int travelTicks = Math.max(1, (int) Math.ceil(path.length()));

        new BukkitRunnable() {
            private int elapsedTicks;

            @Override
            public void run() {
                elapsedTicks++;
                double progress = Math.min(1.0, elapsedTicks / (double) travelTicks);
                Location trailPoint = start.clone().add(path.clone().multiply(progress));
                XParticle.of("SONIC_BOOM").ifPresent(particle ->
                        player.getWorld().spawnParticle(particle.get(), trailPoint, 1));

                if (progress >= 1.0) {
                    cancel();
                    XSound.matchXSound("ENTITY_WARDEN_SONIC_BOOM").ifPresent(sound -> sound.play(player));
                    XParticle.of("SONIC_BOOM").ifPresent(particle ->
                            player.getWorld().spawnParticle(particle.get(), effectLocation, 1));
                    if (hitTarget != null && hitTarget.isValid()) {
                        hitTarget.damage(DAMAGE, player);
                    }
                }
            }
        }.runTaskTimer(this, 0L, 1L);
    }
}