rezn1kishere.com

--- 📎 Attached 1 file(s):

File: pasted-code-1791735818538.txt

txt
Create a complete, working Minecraft Paper plugin named **ZyrovexWardenHeart** for **ZYROVEX SMP**, running Paper 1.21.11.

IMPORTANT: Compile the plugin and provide a ready-to-upload `.jar` file. Do not give me source code only.

**Features:**
- When a Warden dies, the first eligible Warden kill on the entire server drops one custom item named `Warden Heart`.
- Use a Nether Star as the item, with aqua bold name and custom lore.
- Only one Warden Heart can ever be claimed server-wide. Other Wardens must not drop another one after it has been claimed.
- Save the claimed status persistently so it survives server restarts and crashes.
- Keep normal drops and XP for subsequent Warden kills.
- The unique item must have a persistent data tag so renamed ordinary Nether Stars cannot count as the trophy.
- Prevent duplicate claims if multiple Wardens die close together.
- Add `/wardenheart status` to check whether the trophy has been claimed.
- Add `/wardenheart reset` to reset the claim status, restricted to server operators or the `zyrovexwardenheart.admin` permission.
- Register all commands and permissions correctly in `plugin.yml`.
- Use the correct Paper API and Java version for Minecraft 1.21.11.
- Include clear startup logs and handle errors safely.

Build and test the plugin before giving me the `.jar`. Tell me if any feature could not be tested. Also provide the source ZIP as a backup.
📎 1 file 1,427 chars
📄
pasted-code-1791735856318.txt
txt 19 lines
▶
Create a complete, working Minecraft Paper plugin named **ZyrovexWardenHeart** for **ZYROVEX SMP**, running Paper 1.21.11.

IMPORTANT: Compile the plugin and provide a ready-to-upload `.jar` file. Do not give me source code only.

**Features:**
- When a Warden dies, the first eligible Warden kill on the entire server drops one custom item named `Warden Heart`.
- Use a Nether Star as the item, with aqua bold name and custom lore.
- Only one Warden Heart can ever be claimed server-wide. Other Wardens must not drop another one after it has been claimed.
- Save the claimed status persistently so it survives server restarts and crashes.
- Keep normal drops and XP for subsequent Warden kills.
- The unique item must have a persistent data tag so renamed ordinary Nether Stars cannot count as the trophy.
- Prevent duplicate claims if multiple Wardens die close together.
- Add `/wardenheart status` to check whether the trophy has been claimed.
- Add `/wardenheart reset` to reset the claim status, restricted to server operators or the `zyrovexwardenheart.admin` permission.
- Register all commands and permissions correctly in `plugin.yml`.
- Use the correct Paper API and Java version for Minecraft 1.21.11.
- Include clear startup logs and handle errors safely.

Build and test the plugin before giving me the `.jar`. Tell me if any feature could not be tested. Also provide the source ZIP as a backup.
Kodari AI
KodariOct 11 at 4:25 pm 1
WardenHeartTrophy
A Minecraft Paper plugin for ZYROVEX SMP that drops a unique, persistent Warden Heart trophy on the first eligible Warden kill server-wide. Uses a Nether Star with aqua bold name and custom lore, tagged with a persistent data key to prevent forged duplicates. Atomic claim logic prevents race conditions from simultaneous kills. Includes /wardenheart status and /wardenheart reset commands with proper permissions, persistent storage across restarts, and preserves normal drops and XP for subsequent kills. Built for Paper 1.21.11 with Java 21.
  1. Build a Java 21 Paper plugin with the Warden death reward and /wardenheart commands.

  2. Persist claims with an atomic state-file update, including reset and startup error handling.

  3. Add the Paper 1.21.11 build configuration and plugin metadata.

Created the ZyrovexWardenHeart source project with the Warden death reward, persistent server-wide claim state, /wardenheart status and permission-restricted /wardenheart reset, plus Paper 1.21.11 and Java 21 build settings.

I couldn’t compile it or run it on a Paper server in this session, so the build and runtime behavior are unverified. The claim is saved before the item is added to the death drops to prevent duplicate awards; a crash in that brief interval could leave the claim saved without the item dropping. A source ZIP wasn’t generated here.

To build and download the .jar in Kodari:

  1. On desktop, click Compile in the top bar. On phone, tap ⋮ → Compile Project.

  2. Click Compile in the window.

  3. When it succeeds, click Download on the build, or Download ZyrovexWardenHeart.jar in chat.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 255
src/main/java/com/zyrovex/wardenheart/ZyrovexWardenHeart.java
package com.zyrovex.wardenheart;

import com.cryptomorin.xseries.XMaterial;
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.Player;
import org.bukkit.entity.Warden;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.IOException;
import java.util.List;
import java.util.logging.Level;

public final class ZyrovexWardenHeart extends JavaPlugin implements Listener, CommandExecutor {
    private static final String ADMIN_PERMISSION = "zyrovexwardenheart.admin";

    private ClaimStore claimStore;
    private NamespacedKey trophyKey;

    @Override
    public void onEnable() {
        try {
            claimStore = new ClaimStore(getDataFolder().toPath().resolve("claim-state.txt"));
            claimStore.load();
        } catch (IOException exception) {
            getLogger().log(Level.SEVERE, "Could not load or initialize the Warden Heart claim state; disabling plugin.", exception);
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        trophyKey = new NamespacedKey(this, "warden_heart");
        if (getCommand("wardenheart") == null) {
            getLogger().severe("The /wardenheart command is missing from plugin.yml; disabling plugin.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        getCommand("wardenheart").setExecutor(this);
        getServer().getPluginManager().registerEvents(this, this);

        getLogger().info("ZyrovexWardenHeart enabled. Warden Heart is "
                + (claimStore.isClaimed() ? "already claimed." : "available to claim."));
    }

    @EventHandler
    public void onWardenDeath(EntityDeathEvent event) {
        if (!(event.getEntity() instanceof Warden)) {
            return;
        }

        ItemStack heart;
        try {
            heart = createWardenHeart();
            if (!claimStore.tryClaim()) {
                return;
            }
        } catch (IOException | RuntimeException exception) {
            getLogger().log(Level.SEVERE, "Could not securely award the Warden Heart; no trophy was added.", exception);
            return;
        }

        event.getDrops().add(heart);
        getLogger().info("The first server-wide Warden Heart claim has been awarded.");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length != 1) {
            sender.sendMessage(ChatColor.YELLOW + "Usage: /wardenheart <status|reset>");
            return true;
        }

        if (args[0].equalsIgnoreCase("status")) {
            if (claimStore.isClaimed()) {
                sender.sendMessage(ChatColor.AQUA + "The Warden Heart has already been claimed server-wide.");
            } else {
                sender.sendMessage(ChatColor.GREEN + "The Warden Heart is still available from the first Warden kill.");
            }
            return true;
        }

        if (args[0].equalsIgnoreCase("reset")) {
            if (!sender.isOp() && !sender.hasPermission(ADMIN_PERMISSION)) {
                sender.sendMessage(ChatColor.RED + "You do not have permission to reset the Warden Heart claim.");
                return true;
            }
            try {
                claimStore.reset();
                sender.sendMessage(ChatColor.GREEN + "The Warden Heart claim has been reset.");
                getLogger().info("The Warden Heart claim was reset by " + sender.getName() + ".");
            } catch (IOException exception) {
                sender.sendMessage(ChatColor.RED + "Could not save the reset. The claim status was not changed.");
                getLogger().log(Level.SEVERE, "Could not persist a Warden Heart claim reset.", exception);
            }
            return true;
        }

        sender.sendMessage(ChatColor.YELLOW + "Usage: /wardenheart <status|reset>");
        return true;
    }

    private ItemStack createWardenHeart() {
        ItemStack item = XMaterial.matchXMaterial("NETHER_STAR")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("XSeries could not resolve NETHER_STAR"));
        ItemMeta meta = item.getItemMeta();
        if (meta == null) {
            throw new IllegalStateException("Nether Star does not provide item metadata");
        }

        meta.setDisplayName(ChatColor.AQUA.toString() + ChatColor.BOLD + "Warden Heart");
        meta.setLore(List.of(
                ChatColor.GRAY + "A rare trophy claimed from a Warden.",
                ChatColor.DARK_AQUA + "ZYROVEX SMP"
        ));
        meta.getPersistentDataContainer().set(trophyKey, PersistentDataType.BYTE, (byte) 1);
        item.setItemMeta(meta);
        return item;
    }
}