not_cvr

Act as an expert Minecraft Java plugin developer (PaperMC 1.21+ / Spigot API). Write a complete, ready-to-use custom Minecraft plugin in Java.

The plugin must apply the following 8 special abilities specifically to a standard, vanilla Stone Sword (stone_sword) without changing its original vanilla texture/appearance:

  1. Thermal Shockwave: Hitting an entity triggers a lightning strike and pushes nearby enemies backward with Knockback and Slowness effects.
  2. Bleeding / Wither Effect: Applying continuous health damage (Wither/Poison) on hit, bypassing armor partially.
  3. Vampire Steal (Life Steal): Recovering a percentage of dealt damage as health back to the attacker.
  4. Thunder Teleport: Right-clicking the sword teleports the player 10-15 blocks forward in the direction they are looking, spawning lightning at the destination.
  5. Air Dash / Wind Burst: Granting a sudden forward dash/boost when used mid-air or while jumping.
  6. Shield Breaker: Instantly disabling or breaking the opponent's shield on a successful hit.
  7. Passive Buffs: Giving the player active Fire Resistance, Regeneration, and Speed buffs whenever the stone sword is held in the main hand.
  8. Custom Particles & Sounds: Emitting custom particles (e.g., Soul Fire or Electric Sparks) and playing lightning/magic sound effects on movement and attack.

Please provide:

  1. The full Java code classes (Event handlers, Listeners, etc.)
  2. The plugin.yml file
  3. Clear instructions on how to identify this specific stone sword (e.g., using PersistentDataContainer or custom Display Name/Lore) so it only works for this God Sword and not every random stone sword.
Kodari AI
KodariOct 27 at 9:27 am 1
GodStoneSwordAbilities
Implements 8 special abilities for a specific vanilla stone sword identified via PersistentDataContainer. Features thermal shockwave with lightning and knockback, bleeding/wither damage, life steal, thunder teleport on right-click, air dash, shield breaker, passive buffs while held, and custom particles/sounds. Uses event-driven architecture with listeners for combat, movement, and item interactions. Includes plugin.yml configuration and clear identification system using custom data flags to ensure only the designated God Sword receives these powers.
  1. Add the plugin entry point, /godsword item-give command, and PDC-based sword identity.

  2. Implement the eight abilities in a listener, including cooldowns, passive buffs, particles, and sounds.

  3. Add plugin.yml and summarize how to use the marked sword.

Added the God Sword plugin with a vanilla-looking Stone Sword marked by a PersistentDataContainer tag. Ordinary Stone Swords do not activate the abilities.

Use /godsword to receive the marked sword; the command is restricted to players with godsword.give (default: operators). Hold it in your main hand for Fire Resistance, Regeneration, and Speed.

  • Hit: visual lightning, knockback and Slowness nearby, Wither on the target, 25% lifesteal, and shield cooldown when the target is blocking.

  • Right-click: teleports 10–15 blocks forward to a safe landing spot.

  • Sneak + right-click while airborne: air dash.

The item keeps the standard Stone Sword appearance; its PDC marker distinguishes it from regular swords.

Kodari can make mistakes. Review important code before using.
Files
src
Code
3 294
src/main/java/com/kodari/godsword/GodSwordPlugin.java
package com.kodari.godsword;

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

public final class GodSwordPlugin extends JavaPlugin implements CommandExecutor {
    private NamespacedKey godSwordKey;

    @Override
    public void onEnable() {
        godSwordKey = new NamespacedKey(this, "god_sword");

        GodSwordListener listener = new GodSwordListener(this);
        Bukkit.getPluginManager().registerEvents(listener, this);
        Bukkit.getScheduler().runTaskTimer(this, listener::applyPassiveBuffs, 0L, 20L);

        getCommand("godsword").setExecutor(this);
    }

    public boolean isGodSword(ItemStack item) {
        if (item == null || item.getType().isAir()) {
            return false;
        }
        if (!XMaterial.matchXMaterial(item.getType()).name().equals("STONE_SWORD")) {
            return false;
        }

        ItemMeta meta = item.getItemMeta();
        return meta != null && meta.getPersistentDataContainer()
                .getOrDefault(godSwordKey, PersistentDataType.BYTE, (byte) 0) == 1;
    }

    private ItemStack createGodSword() {
        ItemStack sword = XMaterial.matchXMaterial("STONE_SWORD")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("STONE_SWORD is not available"));
        ItemMeta meta = sword.getItemMeta();
        meta.getPersistentDataContainer().set(godSwordKey, PersistentDataType.BYTE, (byte) 1);
        sword.setItemMeta(meta);
        return sword;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("Only a player can receive the God Sword.");
            return true;
        }

        ItemStack sword = createGodSword();
        player.getInventory().addItem(sword).values()
                .forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
        player.sendMessage("Your God Sword is ready.");
        return true;
    }
}