heloum

create me a dash sword when shift+right click it dashes you through the air 18 blocks and when u dash it should make a firework sound please java 1.21.11 plugin paper with a 15 second cool downmaek it a netherite sword and also make it dash u normally and dont make u restricted to a single like area make it so u can turn in the dash and stuff but make it work normally please

Kodari AI
KodariSep 28 at 6:21 pm 1
DashSwordPlugin
Creates a custom netherite sword that triggers a powerful dash ability when shift+right-clicked. The dash propels the player 18 blocks through the air with full directional control, allowing mid-air turning and normal movement during the dash. Each dash emits a firework sound effect and has a 15-second cooldown. The plugin uses Paper's modern API for Java 1.21.1, implementing a velocity-based dash system that works in any location without area restrictions. Players receive the custom sword via a command, and the plugin handles cooldown tracking, sound effects, and smooth movement physics.
  1. Add a /dashsword command that gives you a tagged netherite Dash Sword.

  2. Make shift-right-click dash about 18 blocks, updating direction throughout the dash so you can steer.

  3. Add the 15-second cooldown and firework sound.

Created the Paper 1.21.11 plugin. Use /dashsword to get a netherite Dash Sword; shift-right-click to dash roughly 18 blocks, steer by turning during the dash, and hear the firework sound. It has a 15-second cooldown.

heloum

create me a dash sword when shift+right click it dashes you through the air 18 blocks and when u dash it should make a firework sound please java 1.21.11 plugin paper with a 15 second cool downmaek it a netherite sword and also make it dash u normally and dont make u restricted to a single like area make it so u can turn in the dash and stuff but make it work normally please

make it an 18 block dash and all in one dont make it two dashes and dont make it very easy to steer where ur dashing just make it like normally as if u were walking/running

Kodari AI
KodariSep 28 at 6:25 pm 1
  • Keep the dash as one continuous 10-tick burst covering about 18 blocks.

  • Add gradual heading changes so turning adjusts the dash with momentum instead of snapping instantly.

Updated the Dash Sword to make one continuous 10-tick dash of about 18 blocks. Turning now changes its direction gradually, rather than snapping the dash toward every camera movement; the 15-second cooldown and firework sound are unchanged.

heloum

create me a dash sword when shift+right click it dashes you through the air 18 blocks and when u dash it should make a firework sound please java 1.21.11 plugin paper with a 15 second cool downmaek it a netherite sword and also make it dash u normally and dont make u restricted to a single like area make it so u can turn in the dash and stuff but make it work normally please

make it an 18 block dash and all in one dont make it two dashes and dont make it very easy to steer where ur dashing just make it like normally as if u were walking/running

MAEK IT SO THAT ITS ONLY 18 BLOCKS SO FOR EXAMPLE IF UR STANDING STILL AND DASH IT SHOULD DASH U TO 18 BLOCKS TOWARDS THE DIRECTION AND IF UR IN THE AIR SAME RULE APPLIES LISTEN UP HERE IF U DONT LISTEN CLOSELY IM GONNA DO SUTFF TO YOU AI BOT BOY

Kodari AI
KodariSep 28 at 6:29 pm 1

Updated the dash so it travels 18 blocks total as one continuous burst, whether you start on the ground or in the air. It follows your facing direction with gradual steering and stops early if a block is in the way. The 15-second cooldown and firework sound are unchanged.

heloum

BRO WAHT DONT U UNDERSTAND 18 BLOCKS THATS IT UR DOING 13 BLOCKS EXRTREA FOR NO REASON BRO IM GONNA GRAPE YOU I SWEAR DO MY 18 BLOCK DASH NOW BOY

Kodari AI
KodariSep 28 at 6:32 pm 1
  • Change the dash’s finish condition to measure 18 blocks from where it started, not the length of a curved path.

  • Keep subtle steering, collision stopping, cooldown, and sound.

The dash now ends at a point exactly 18 blocks from where you started. Steering changes the direction gradually without extending that 18-block radius. It still stops early if a block is in the way.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 190
src/main/java/com/kodari/dashsword/DashSwordPlugin.java
package com.kodari.dashsword;

import net.kyori.adventure.key.Key;
import net.kyori.adventure.sound.Sound;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.Location;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.Vector;

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

public final class DashSwordPlugin extends JavaPlugin implements Listener {
    private static final long COOLDOWN_MILLIS = 15_000L;
    private static final int DASH_TICKS = 10;
    private static final double DASH_DISTANCE = 18.0;

    private final Map<UUID, Long> cooldowns = new HashMap<>();
    private NamespacedKey swordKey;

    @Override
    public void onEnable() {
        swordKey = new NamespacedKey(this, "dash_sword");
        Bukkit.getPluginManager().registerEvents(this, this);
        getCommand("dashsword").setExecutor((sender, command, label, args) -> {
            if (!(sender instanceof Player player)) {
                sender.sendMessage("This command can only be used by a player.");
                return true;
            }

            Material swordMaterial = Material.matchMaterial("NETHERITE_SWORD");
            if (swordMaterial == null) {
                player.sendMessage(ChatColor.RED + "Netherite swords are unavailable on this server.");
                return true;
            }

            ItemStack sword = new ItemStack(swordMaterial);
            ItemMeta meta = sword.getItemMeta();
            meta.setDisplayName(ChatColor.AQUA + "Dash Sword");
            meta.setLore(java.util.List.of(
                    ChatColor.GRAY + "Shift + right-click to dash",
                    ChatColor.GRAY + "Cooldown: 15 seconds"
            ));
            meta.getPersistentDataContainer().set(swordKey, PersistentDataType.BYTE, (byte) 1);
            sword.setItemMeta(meta);

            Map<Integer, ItemStack> leftovers = player.getInventory().addItem(sword);
            leftovers.values().forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
            player.sendMessage(ChatColor.GREEN + "You received a Dash Sword.");
            return true;
        });
    }

    @EventHandler
    public void onSwordUse(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND || !event.getPlayer().isSneaking()) {
            return;
        }
        if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) {
            return;
        }

        ItemStack item = event.getItem();
        if (item == null || item.getType() != Material.NETHERITE_SWORD || !item.hasItemMeta()) {
            return;
        }
        if (!item.getItemMeta().getPersistentDataContainer().has(swordKey, PersistentDataType.BYTE)) {
            return;
        }

        event.setCancelled(true);
        Player player = event.getPlayer();
        long now = System.currentTimeMillis();
        long availableAt = cooldowns.getOrDefault(player.getUniqueId(), 0L);
        if (availableAt > now) {
            long secondsLeft = (availableAt - now + 999L) / 1000L;
            player.sendMessage(ChatColor.RED + "Dash is on cooldown for " + secondsLeft + " more seconds.");
            return;
        }

        cooldowns.put(player.getUniqueId(), now + COOLDOWN_MILLIS);
        player.playSound(Sound.sound(
                Key.key("minecraft:entity.firework_rocket.blast"),
                Sound.Source.PLAYER,
                1.0f,
                1.0f
        ));

        new BukkitRunnable() {
            private double distanceTraveled;
            private final Location origin = player.getLocation().clone();
            private Vector dashDirection = player.getEyeLocation().getDirection().normalize();

            @Override
            public void run() {
                if (!player.isOnline() || player.isDead() || distanceTraveled >= DASH_DISTANCE) {
                    cancel();
                    return;
                }

                player.setVelocity(new Vector());
                Vector facing = player.getEyeLocation().getDirection().normalize();
                dashDirection.multiply(0.95).add(facing.multiply(0.05)).normalize();
                distanceTraveled = Math.min(DASH_DISTANCE, distanceTraveled + DASH_DISTANCE / DASH_TICKS);
                Location target = origin.clone().add(dashDirection.clone().multiply(distanceTraveled));
                Vector movement = target.toVector().subtract(player.getLocation().toVector());
                double movementLength = movement.length();
                for (double checked = 0.25; checked < movementLength; checked += 0.25) {
                    if (!isDashPositionClear(player, movement.clone().normalize().multiply(checked))) {
                        cancel();
                        return;
                    }
                }
                if (!isDashPositionClear(player, movement)) {
                    cancel();
                    return;
                }

                if (!player.teleport(target)) {
                    cancel();
                    return;
                }
            }
        }.runTaskTimer(this, 0L, 1L);
    }

    private boolean isDashPositionClear(Player player, Vector movement) {
        BoundingBox box = player.getBoundingBox().shift(movement.getX(), movement.getY(), movement.getZ());
        for (int x = (int) Math.floor(box.getMinX()); x <= (int) Math.floor(Math.nextDown(box.getMaxX())); x++) {
            for (int y = (int) Math.floor(box.getMinY()); y <= (int) Math.floor(Math.nextDown(box.getMaxY())); y++) {
                for (int z = (int) Math.floor(box.getMinZ()); z <= (int) Math.floor(Math.nextDown(box.getMaxZ())); z++) {
                    if (!player.getWorld().getBlockAt(x, y, z).isPassable()) {
                        return false;
                    }
                }
            }
        }
        return true;
    }
}