Skplayz444 Skplayz444

Create a complete Minecraft PaperMC plugin for a Netherite God Sword with exactly the following two abilities.

  1. Sonic Boom Ability
  • The sword must use the normal vanilla Minecraft NETHERITE_SWORD material.
  • When the player right-clicks while holding the sword, it must launch a Sonic Boom attack similar to the Minecraft Warden's sonic boom.
  • Use the actual Warden-style sonic boom mechanics, including its directional attack, sonic particles, sound effects, and visual effects.
  • The attack must deal damage comparable to the Warden's Sonic Boom attack. Players hit by it must receive the same base damage as the Warden's sonic boom, using the correct vanilla damage mechanics.
  • The attack must work against players and must visibly damage them with proper damage feedback and particles.
  • Add a 5-second cooldown after each successful activation.
  • Display an appropriate cooldown message when the player tries to use the ability before the cooldown ends.
  1. Total Bypass Ability
  • When the player is holding the God Sword and performs SHIFT + LEFT-CLICK, activate Total Bypass.
  • The attack must bypass the target player's armor protection and armor durability calculations.
  • One successful hit must instantly break the target player's equipped armor pieces, including helmet, chestplate, leggings, and boots, regardless of their material or durability.
  • If the target player has a Totem of Undying in either hand, the attack must bypass and consume the totem's protection so that the target cannot survive the hit using that totem.
  • Ensure the ability works correctly in PvP and does not accidentally trigger during ordinary left-click attacks.
  • Handle armor breaking and totem bypass explicitly through Paper/Bukkit events and supported server mechanics, rather than merely displaying effects.

Technical Requirements

  • Target Minecraft PaperMC 1.21.11 and use a compatible Java version and API.
  • Provide the complete Java source code, "plugin.yml", and any required project configuration files.
  • Make both abilities work reliably on a multiplayer server.
  • Prevent unintended activation of abilities with ordinary vanilla swords. Only the designated Netherite God Sword should activate them.
  • Preserve normal sword behavior for all attacks and interactions that do not activate these abilities.
  • Ensure cooldown tracking, event handling, damage application, and armor durability changes are implemented correctly.
  • Do not include any additional abilities, commands, crafting recipes, or unrelated features.
  • Explain how to compile the plugin into a ".jar" file and install it on a PaperMC server.

Deliver a complete, compilable plugin project, not pseudocode or incomplete examples.

Kodari AI
KodariOct 28 at 8:27 am 2
NetheriteGodSword
A PaperMC plugin adding a special Netherite sword with two unique abilities. Right-click launches a Warden-style Sonic Boom attack dealing 10 damage with directional particles and sounds, on a 5-second cooldown. Shift-left-click activates Total Bypass, instantly breaking all target armor pieces and consuming any Totem of Undying protection. Both abilities work in PvP with proper cooldown tracking and event handling.
  1. Add the Paper 1.21.11 / Java 21 project files.

  2. Implement both abilities with a persistent sword marker, native sonic-boom damage, cooldowns, and explicit armor/totem handling.

  3. Explain Kodari’s compile flow and how to install the jar.

Created a Paper 1.21.11 plugin project targeting Java 21 with both abilities:

  • Sonic Boom: Right-click with the marked sword to fire a 15-block directional attack. It uses the Warden sonic-boom damage type, particles, and sound; damage scales with difficulty, and a successful activation starts a 5-second cooldown.

  • Total Bypass: Sneak-hit another player with the marked sword to remove their equipped armor and any totems in either hand, then apply the hit’s unmitigated damage. Ordinary Netherite Swords do not activate either ability.

The sword is identified by a plugin-owned persistent-data marker, not just its name or material. The project adds no command or recipe; integrations can create a marked sword through NetheriteGodSwordPlugin#createGodSword().

Compile and install: On desktop, click Compile in the top bar; on phone, tap ⋮ → Compile Project. Click Compile in the window, then Download when the build succeeds. Put the downloaded jar in your Paper server’s plugins/ folder and restart the server.

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

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.damage.DamageSource;
import org.bukkit.damage.DamageType;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
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.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

public final class NetheriteGodSwordPlugin extends JavaPlugin implements Listener {
    private static final long SONIC_BOOM_COOLDOWN_MILLIS = 5_000L;
    private static final double SONIC_BOOM_RANGE = 15.0;
    private final Map<UUID, Long> sonicBoomCooldowns = new HashMap<>();
    private final Set<UUID> applyingAbilityDamage = new HashSet<>();
    private NamespacedKey godSwordKey;

    @Override
    public void onEnable() {
        godSwordKey = new NamespacedKey(this, "god_sword");
        getServer().getPluginManager().registerEvents(this, this);
    }

    public ItemStack createGodSword() {
        ItemStack sword = XMaterial.matchXMaterial("NETHERITE_SWORD")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("NETHERITE_SWORD is unavailable"));
        ItemMeta meta = sword.getItemMeta();
        meta.setDisplayName(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Netherite God Sword");
        meta.getPersistentDataContainer().set(godSwordKey, PersistentDataType.BYTE, (byte) 1);
        sword.setItemMeta(meta);
        return sword;
    }

    private boolean isGodSword(ItemStack item) {
        if (item == null || item.getType().isAir()
                || !XMaterial.matchXMaterial(item.getType()).name().equals("NETHERITE_SWORD")) {
            return false;
        }
        ItemMeta meta = item.getItemMeta();
        return meta != null
                && meta.getPersistentDataContainer().has(godSwordKey, PersistentDataType.BYTE);
    }

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

        Player player = event.getPlayer();
        long now = System.currentTimeMillis();
        long cooldownUntil = sonicBoomCooldowns.getOrDefault(player.getUniqueId(), 0L);
        if (cooldownUntil > now) {
            double secondsLeft = (cooldownUntil - now) / 1000.0;
            player.sendMessage(ChatColor.RED + "Sonic Boom is on cooldown for "
                    + String.format(java.util.Locale.US, "%.1f", secondsLeft) + "s.");
            return;
        }

        launchSonicBoom(player);
        sonicBoomCooldowns.put(player.getUniqueId(), now + SONIC_BOOM_COOLDOWN_MILLIS);
    }

    private void launchSonicBoom(Player player) {
        Location start = player.getEyeLocation();
        Vector direction = start.getDirection().normalize();
        LivingEntity target = findSonicBoomTarget(player, start, direction);
        double travelDistance = SONIC_BOOM_RANGE;
        if (target != null) {
            Vector targetCenter = target.getLocation().add(0, target.getHeight() * 0.5, 0).toVector();
            travelDistance = Math.min(SONIC_BOOM_RANGE, targetCenter.distance(start.toVector()));
        }

        World world = player.getWorld();
        playSound(world, start, "ENTITY_WARDEN_SONIC_BOOM", 1.0f, 1.0f);
        double trailDistance = travelDistance;
        XParticle.of("SCULK_SOUL").ifPresent(particle -> {
            for (double distance = 0.5; distance < trailDistance; distance += 0.5) {
                Location point = start.clone().add(direction.clone().multiply(distance));
                world.spawnParticle(particle.get(), point, 1, 0, 0, 0, 0);
            }
        });

        if (target == null) {
            return;
        }

        Location impact = target.getLocation().add(0, target.getHeight() * 0.5, 0);
        XParticle.of("SONIC_BOOM").ifPresent(particle ->
                world.spawnParticle(particle.get(), impact, 1, 0, 0, 0, 0));
        playSound(world, impact, "ENTITY_WARDEN_SONIC_BOOM", 1.0f, 1.0f);
        DamageSource source = DamageSource.builder(DamageType.SONIC_BOOM)
                .withCausingEntity(player)
                .withDirectEntity(player)
                .build();
        applyAbilityDamage(target, sonicBoomDamage(world), source);
    }

    private LivingEntity findSonicBoomTarget(Player player, Location start, Vector direction) {
        LivingEntity closestTarget = null;
        double closestDistance = SONIC_BOOM_RANGE + 1.0;
        for (Entity entity : player.getWorld().getNearbyEntities(start,
                SONIC_BOOM_RANGE, SONIC_BOOM_RANGE, SONIC_BOOM_RANGE)) {
            if (!(entity instanceof LivingEntity living) || living.equals(player) || living.isDead()) {
                continue;
            }

            Vector toTarget = living.getLocation()
                    .add(0, living.getHeight() * 0.5, 0)
                    .toVector()
                    .subtract(start.toVector());
            double distanceAlongRay = toTarget.dot(direction);
            if (distanceAlongRay < 0 || distanceAlongRay > SONIC_BOOM_RANGE
                    || distanceAlongRay >= closestDistance) {
                continue;
            }

            double distanceFromRay = toTarget.subtract(direction.clone().multiply(distanceAlongRay)).length();
            if (distanceFromRay <= 0.9) {
                closestTarget = living;
                closestDistance = distanceAlongRay;
            }
        }
        return closestTarget;
    }

    private double sonicBoomDamage(World world) {
        return switch (world.getDifficulty().name()) {
            case "EASY" -> 6.0;
            case "HARD" -> 15.0;
            case "PEACEFUL" -> 0.0;
            default -> 10.0;
        };
    }

    private void playSound(World world, Location location, String soundName, float volume, float pitch) {
        XSound.matchXSound(soundName).ifPresent(sound ->
                world.playSound(location, sound.get(), volume, pitch));
    }

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onPlayerAttack(EntityDamageByEntityEvent event) {
        if (!(event.getDamager() instanceof Player attacker)
                || !(event.getEntity() instanceof Player target)
                || !attacker.isSneaking()
                || !isGodSword(attacker.getInventory().getItemInMainHand())
                || applyingAbilityDamage.contains(target.getUniqueId())) {
            return;
        }

        double unmitigatedDamage = event.getDamage();
        event.setCancelled(true);
        breakEquippedArmor(target);
        consumeHandTotems(target);

        DamageSource source = DamageSource.builder(DamageType.PLAYER_ATTACK)
                .withCausingEntity(attacker)
                .withDirectEntity(attacker)
                .build();
        applyAbilityDamage(target, unmitigatedDamage, source);
    }

    private void breakEquippedArmor(Player target) {
        target.getInventory().setHelmet(null);
        target.getInventory().setChestplate(null);
        target.getInventory().setLeggings(null);
        target.getInventory().setBoots(null);
    }

    private void consumeHandTotems(Player target) {
        if (isTotem(target.getInventory().getItemInMainHand())) {
            target.getInventory().setItemInMainHand(null);
        }
        if (isTotem(target.getInventory().getItemInOffHand())) {
            target.getInventory().setItemInOffHand(null);