not_cvr

Create a fully working Minecraft Java plugin called E-Stone Sword for Paper/Spigot 1.21.x servers. Use a vanilla sword with no custom textures or resource packs. Make it extremely OP, dealing 5 hearts of damage even to players wearing full Netherite Armor. Right-click: strike enemies with lightning. Left-click: shoot a fast arrow at distant enemies; at close range, create a powerful ground-shattering crater effect. Add particle effects, sounds, configurable damage and cooldowns. Include all required Java files, plugin.yml, config.yml and pom.xml. Keep the code simple, compile-ready, and free of errors. Build the actual downloadable EStoneSword.jar if compilation is supported.

Kodari AI
KodariOct 26 at 2:09 pm 1
EStoneSword
A powerful Minecraft plugin adding an extremely overpowered vanilla sword. Right-click strikes enemies with lightning, left-click shoots fast arrows at range or creates a ground-shattering crater effect at close range. Deals 5 hearts of damage even through full Netherite armor. Features configurable damage, cooldowns, particle effects, and sounds. Includes full source code, plugin.yml, config.yml, and pom.xml for Paper/Spigot 1.21.x.

I’ll create the plugin with configurable damage and cooldowns, a give command, lightning and arrow abilities, and a visual crater attack.

  1. Add the plugin entry point and sword command.

  2. Implement the abilities, cooldowns, and armor-bypassing damage.

  3. Add the Maven build file and Paper/Spigot plugin and config files.

Created the E-Stone Sword plugin with /estonesword [player] to obtain it. The default melee damage is 10 damage (5 hearts) and bypasses armor; right-click calls lightning, while left-click makes a crater at close range or fires an arrow farther away. Damage, cooldowns, ranges, and crater effects are configurable in config.yml.

To build and download EStoneSword.jar, click Compile in the top bar, then click Compile in the window that opens. Once it succeeds, click Download for that build.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
5 374
src/main/java/com/kodari/estonesword/EStoneSwordPlugin.java
package com.kodari.estonesword;

import com.cryptomorin.xseries.XMaterial;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
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 EStoneSwordPlugin extends JavaPlugin implements CommandExecutor {
    private NamespacedKey swordKey;
    private NamespacedKey projectileKey;
    private final Map<UUID, Double> pendingDamage = new HashMap<>();

    @Override
    public void onEnable() {
        saveDefaultConfig();
        swordKey = new NamespacedKey(this, "e_stone_sword");
        projectileKey = new NamespacedKey(this, "e_stone_projectile");
        getServer().getPluginManager().registerEvents(new SwordAbilityListener(this), this);
        getCommand("estonesword").setExecutor(this);
    }

    public ItemStack createSword() {
        ItemStack sword = XMaterial.matchXMaterial("NETHERITE_SWORD")
                .map(XMaterial::parseItem)
                .orElse(null);
        if (sword == null) {
            throw new IllegalStateException("Could not create a netherite sword.");
        }

        ItemMeta meta = sword.getItemMeta();
        meta.setDisplayName(color(getConfig().getString("item.name", "&b&lE-Stone Sword")));
        meta.setLore(getConfig().getStringList("item.lore").stream().map(this::color).toList());
        meta.getPersistentDataContainer().set(swordKey, PersistentDataType.BYTE, (byte) 1);
        sword.setItemMeta(meta);
        return sword;
    }

    public boolean isEStoneSword(ItemStack item) {
        if (item == null || !item.hasItemMeta()) {
            return false;
        }
        return item.getItemMeta().getPersistentDataContainer().has(swordKey, PersistentDataType.BYTE);
    }

    public NamespacedKey getProjectileKey() {
        return projectileKey;
    }

    public void dealArmorBypassingDamage(LivingEntity target, double damage, Entity source) {
        UUID targetId = target.getUniqueId();
        pendingDamage.put(targetId, damage);
        target.damage(damage, source);
        Bukkit.getScheduler().runTaskLater(this, () -> pendingDamage.remove(targetId), 1L);
    }

    public Double consumePendingDamage(UUID targetId) {
        return pendingDamage.remove(targetId);
    }

    private String color(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }

    private String message(String path, String fallback) {
        return color(getConfig().getString(path, fallback));
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player target;
        if (args.length == 0) {
            if (!(sender instanceof Player player)) {
                sender.sendMessage(message("messages.player-only", "&cOnly a player can receive the sword this way."));
                return true;
            }
            target = player;
        } else {
            String targetName = args.length > 1 ? args[1] : args[0];
            target = Bukkit.getPlayerExact(targetName);
            if (target == null) {
                sender.sendMessage(message("messages.player-not-found", "&cThat player is not online."));
                return true;
            }
        }

        Map<Integer, ItemStack> leftovers = target.getInventory().addItem(createSword());
        leftovers.values().forEach(item -> target.getWorld().dropItemNaturally(target.getLocation(), item));
        if (sender.equals(target)) {
            target.sendMessage(message("messages.received", "&aYou received the E-Stone Sword."));
        } else {
            sender.sendMessage(message("messages.given", "&aYou gave an E-Stone Sword to %player%.")
                    .replace("%player%", target.getName()));
            target.sendMessage(message("messages.received", "&aYou received the E-Stone Sword."));
        }
        return true;
    }
}