kaydnn

Create a java 1.21.11 plugin where a fishing rod with 1 durability spawns a warden whenever the player casts the rod, the rod can only be used once (Inspiration from orbital strike cannon), the warden targets a player nearest to the fishing bobber

Kodari AI
KodariJun 19 at 9:15 am 9

I’ll create a fishing rod warden strike plugin.

WardenStrike
A unique combat plugin that allows players to summon wardens using a fishing rod with 1 durability remaining. When cast, the rod spawns a warden at the bobber's location that targets the nearest player. The rod breaks after use, creating a powerful one-time weapon inspired by orbital strike mechanics. Perfect for PvP arenas and special events.

Done! The plugin spawns a warden at the fishing bobber location when a rod with exactly 1 durability is cast. The warden automatically targets the nearest player within 50 blocks. Use /wardenstrike to get the special rod.

kaydnn

make it so the wardenstrike command can only be used by OPERATORS, and add a fishing rod that spawns a 20 pufferfish per use, has 15 uses

Kodari AI
KodariJun 19 at 10:24 am 17
kaydnn

only allow operators to use pufferfish rod

Kodari AI
KodariJun 19 at 10:28 am 5

Done! Both /wardenstrike and /pufferfishstrike commands now require operator permissions.

kaydnn

make wardenstrike and pufferfishstrike both not enchantable, and not repairable via using RepairCost and Enchantable values.

Fix pufferfish strike, currently it does not spawn pufferfish and when it reaches 1 durability it spawns warden. Make it spawn 20 pufferfish everytime i cast the pufferfish rod

Kodari AI
KodariJun 20 at 2:28 am 17

Done! Fixed:

  • Both rods now have RepairCost set to Integer.MAX_VALUE (unrepairable in anvils)

  • Pufferfish rod now spawns 20 pufferfish every cast (fixed display name mismatch)

  • Pufferfish rod no longer spawns wardens at 1 durability (separate checks for each rod type)

  • Removed duplicate operator permission checks in WardenStrikeCommand

kaydnn

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/com/example/wardenstrike/PufferfishStrikeCommand.java at line 46: cannot find symbol
        meta.setRepairCost(Integer.MAX_VALUE);
            ^
  symbol: method setRepairCost(int)
  location: variable meta of type ItemMeta

ERROR in src/main/java/com/example/wardenstrike/WardenStrikeCommand.java at line 46: cannot find symbol
        meta.setRepairCost(Integer.MAX_VALUE);
            ^
  symbol: method setRepairCost(int)
  location: variable meta of type ItemMeta


=== COMPILATION ERROR ANALYSIS ===

MISSING METHODS:
  - setRepairCost(int)
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/com/example/wardenstrike/PufferfishStrikeCommand.java
  - src/main/java/com/example/wardenstrike/WardenStrikeCommand.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJun 20 at 2:30 am 11

Fixed! Both rods now use the Repairable interface correctly to set repair cost. The rods are now unrepairable and unenchantable in anvils.

kaydnn

Make the pufferfish and warden rod use 1 durability after striking, and make it not enchantable via enchanting table

Kodari AI
KodariJun 20 at 3:16 am 39

Done! Now both rods:

  • Consume 1 durability after each strike

  • Cannot be enchanted via enchanting table (EnchantListener blocks it)

  • Cannot be repaired in anvil (RepairCost set to max value)

kaydnn

Make the pufferfish rod and warden rod both break upon reaching 0 durability

kaydnn

Make the pufferfish rod and warden rod both break upon reaching 0 durability

Kodari AI
KodariJun 25 at 8:32 am 13

Done! Both rods now break automatically when they reach 0 durability. The rod is removed from the player’s hand and they get a message indicating the rod was destroyed.

kaydnn

Make warden rod craftable with this recipe Dragon egg on top, fishing rod in middle and sculk catalyst at the bottom. Make the fishing rod not burnable, cactused, exploded

1 image attached
Kodari AI
KodariAug 22 at 6:39 am 5
  1. Add the vertical Warden Rod crafting recipe.

  2. Protect dropped Warden Rod items from fire, cactus, and explosion damage.

  • Reuse the exact Warden Rod item definition for crafting and /wardenstrike.

  • Register the dragon-egg/fishing-rod/sculk-catalyst recipe.

  • Cancel fire, cactus/contact, and explosion damage to dropped Warden Rod items.

  1. Added the vertical recipe: Dragon Egg → Fishing Rod → Sculk Catalyst, producing a Warden Strike Rod.

  2. Dropped Warden Strike Rods now survive fire, lava, cactus damage, and explosions.

kaydnn

Add an advancement "Calls from The Abyss", a challenge advancement, put it at under root of "The End?". Players will obtain this advancement when they obtain the warden rod

Kodari AI
KodariAug 22 at 6:46 am 4
  • Add a challenge advancement beneath the vanilla “The End?” root.

  • Install its datapack on first enable and reload server data so Minecraft registers it.

  • Award it when a player receives the Warden Rod through the command, crafting, or item pickup.

Added “Calls from The Abyss” as a challenge advancement under The End?.

It is granted when players obtain a Warden Strike Rod through:

  • /wardenstrike

  • Crafting the rod

  • Picking up a dropped rod

The plugin now installs and reloads its advancement datapack automatically on first enable.

kaydnn

This error occured and when i picked up the rod i didn't get any advancement

1 image attached
Kodari AI
KodariAug 22 at 6:54 am 2
  • Correct the datapack advancement directory so Minecraft discovers it.

  • Replace the previously installed invalid advancement file during startup.

  • Reload datapacks before registering the plugin’s runtime crafting recipe.

kaydnn

Solve the issue for me, there was no datapack in the world datapack folder.

Kodari AI
KodariAug 22 at 6:57 am 2
  • Install the advancement datapack in the loaded world’s actual datapacks directory.

  • Overwrite stale advancement files so corrected data is deployed on the next startup.

  • Reload data only after the datapack has been written.

Installed the advancement datapack into the active world’s datapacks/wardenstrike_advancements folder and overwrite it each startup. The server reloads data immediately afterward, allowing pickups to award Calls from The Abyss.

kaydnn

When i do /reload i can't craft the warden rod anymore, and the advancement still doesn't work, despite me putting the files already

Kodari AI
KodariAug 22 at 7:09 am 4
  1. Make the recipe survive /reload by defining it in the datapack instead of only at runtime.

  2. Register and award the advancement from the datapack’s correct namespace/path.

  • Correct the datapack’s required data/<namespace>/advancements directory.

  • Re-register the runtime recipe after reload so the custom Warden Rod output remains available.

  • Keep the existing pickup/craft/command award flow pointed at the corrected advancement key.

  1. Warden Rod crafting is restored after /reload; its recipe is re-registered once the reload completes.

  2. Fixed the datapack structure from advancement to the required advancements directory, so Calls from The Abyss can load and be awarded on rod pickup, crafting, or /wardenstrike.

kaydnn

The advancement works now, but after i /reload the recipe does not work anymore

1 image attached
Kodari AI
KodariAug 22 at 7:27 am 2
  • Re-register the runtime-only Warden Rod recipe one tick after /reload has fully rebuilt Minecraft’s recipe registry.

Fixed /reload recipe loss: the Warden Rod recipe now re-registers one tick after Minecraft finishes rebuilding its recipe registry.

kaydnn

Change it from one use to infinite uses, but has a 24 hour cooldown

Kodari AI
KodariSep 4 at 5:52 am 4
  • Make newly created Warden Rods unbreakable and update their lore/command messaging.

  • Store each Warden Rod’s next usable time in persistent item data.

  • On cast, summon the Warden only when its 24-hour cooldown has expired.

Warden Rods now have infinite uses and are unbreakable. Each successful Warden Strike starts a 24-hour per-rod cooldown, with a remaining-time message if cast early.

kaydnn

Add cooldown to the warden strike like the shield on minecraft, and make sure they can't change the name of the warden strike on anvil. They can still change the name and then the rod doesnt work anymore

1 image attached
Kodari AI
KodariSep 4 at 6:03 am 4
  1. Apply Minecraft’s item-use cooldown overlay to Warden Strike casts for the full 24-hour cooldown.

  2. Block anvil renaming of Warden Strike Rods without affecting ordinary anvil use.

  1. Warden Strike now shows Minecraft’s cooldown overlay for its 24-hour cooldown.

  2. Warden Rods have a persistent identity tag, so renaming cannot make them stop working.

  3. Anvil output is blocked whenever a Warden Strike Rod is placed in the first slot.

kaydnn

It puts all fishing rods on cooldown, even pufferfish rod and normal fishing rod. I only want cooldown on the specific warden rod that i pulled

Kodari AI
KodariSep 4 at 6:08 am 2
  • Remove Bukkit’s material-wide cooldown call, which affects every fishing rod.

  • Keep the existing persistent 24-hour timestamp on each individual Warden Rod.

  • Preserve the Warden Rod-only cooldown check when it is cast.

Removed Bukkit’s material-based cooldown, which was applying to all fishing rods. The 24-hour cooldown now remains stored and enforced only on the individual Warden Rod used.

kaydnn

The advancement didnt work, what do i need to do to make it work

Kodari AI
KodariSep 4 at 6:27 am 1

To make the advancement work, verify these points:

  1. The datapack must be in the active world folder, not the plugin folder:

    Plain Text
    <server>/<world>/datapacks/wardenstrike_advancements/
    
  2. Its structure must be exactly:

    Plain Text
    wardenstrike_advancements/
    ├─ pack.mcmeta
    └─ data/
       └─ wardenstrike/
          └─ advancements/
             └─ calls_from_the_abyss.json
    

    The folder is advancements (plural).

  3. Run:

    Plain Text
    /reload
    

    or fully restart the server after adding/changing datapack files.

  4. Confirm Minecraft loaded it:

    Plain Text
    /datapack list enabled
    

    You should see the Warden Strike datapack listed.

  5. Test whether Minecraft recognizes the advancement at all:

    Plain Text
    /advancement grant <your name> only wardenstrike:calls_from_the_abyss
    
    • If this works, the datapack is loaded and the issue is with the rod detection/listener.

    • If it says the advancement does not exist, the datapack is in the wrong world, has the wrong folder structure, or has invalid JSON.

  6. If you have multiple worlds, make sure it is in the datapacks folder of the world players are actually using—usually:

    Plain Text
    world/datapacks/
    

    rather than world_nether or world_the_end.

kaydnn

it doesnt come up as an option

1 image attached
Kodari AI
KodariSep 4 at 6:45 am 1

The generation was stopped before any content could be produced.

kaydnn

it doesnt come up as an option but it exists in the files

2 images attached
Kodari AI
KodariSep 4 at 6:46 am 3

The datapack is enabled, but the advancement JSON uses the newer icon format that is invalid on this plugin’s 1.21.1 target. I’ll change it to the 1.21.1 format so Minecraft registers wardenstrike:calls_from_the_abyss.

Fixed the advancement JSON for your 1.21.1 server: its icon must use "item", not "id".

Upload the rebuilt plugin JAR, then restart the server (or run /reload once). The plugin will overwrite the datapack file, reload datapacks, and the command should then recognize:

Mcfunction
/advancement grant SinkernTree only wardenstrike:calls_from_the_abyss
kaydnn

Change it from advancement to be "player has crafted the WARDEN ROD!", with the words warden rod in blue color

Kodari AI
KodariSep 4 at 6:51 am 2
  • Replace the advancement award with a server-wide craft announcement.

  • Color only WARDEN ROD blue.

  • Announce exclusively when the rod is crafted, not when it is picked up.

Replaced the advancement with a server-wide craft announcement:

<player> has crafted the WARDEN ROD!

Only WARDEN ROD is blue, and it triggers only when the rod is crafted.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
13 589
src/main/java/com/example/wardenstrike/WardenStrikePlugin.java
package com.example.wardenstrike;

import com.cryptomorin.xseries.XMaterial;
import com.example.wardenstrike.listener.EnchantListener;
import com.example.wardenstrike.listener.FishingListener;
import com.example.wardenstrike.listener.WardenRodAnvilListener;
import com.example.wardenstrike.listener.WardenRodAdvancementListener;
import com.example.wardenstrike.listener.WardenRodProtectionListener;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.server.ServerLoadEvent;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;

public class WardenStrikePlugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
        getServer().getPluginManager().registerEvents(new FishingListener(this), this);
        getServer().getPluginManager().registerEvents(new EnchantListener(), this);
        getServer().getPluginManager().registerEvents(new WardenRodAnvilListener(), this);
        getServer().getPluginManager().registerEvents(new WardenRodProtectionListener(), this);
        getServer().getPluginManager().registerEvents(new WardenRodAdvancementListener(), this);
        getCommand("wardenstrike").setExecutor(new WardenStrikeCommand());
        getCommand("pufferfishstrike").setExecutor(new PufferfishStrikeCommand());
        if (installAdvancementDataPack()) {
            getServer().reloadData();
        }
        registerWardenRodRecipe();
        getLogger().info("WardenStrike has been enabled!");
    }

    @EventHandler
    public void onServerLoad(ServerLoadEvent event) {
        if (event.getType() == ServerLoadEvent.LoadType.RELOAD) {
            getServer().getScheduler().runTaskLater(this, this::registerWardenRodRecipe, 1L);
        }
    }

    private boolean installAdvancementDataPack() {
        if (getServer().getWorlds().isEmpty()) {
            getLogger().severe("Could not install the WardenStrike advancement datapack because no world is loaded.");
            return false;
        }

        Path dataPack = getServer().getWorlds().get(0).getWorldFolder().toPath()
                .resolve("datapacks").resolve("wardenstrike_advancements");
        Path advancement = dataPack.resolve("data").resolve("wardenstrike").resolve("advancements").resolve("calls_from_the_abyss.json");

        try {
            copyResource("wardenstrike_advancements/pack.mcmeta", dataPack.resolve("pack.mcmeta"));
            copyResource("wardenstrike_advancements/data/wardenstrike/advancements/calls_from_the_abyss.json", advancement);
            Files.deleteIfExists(dataPack.resolve("data").resolve("wardenstrike").resolve("advancement").resolve("calls_from_the_abyss.json"));
            getLogger().info("Installed WardenStrike advancement datapack at " + dataPack + ".");
            return true;
        } catch (IOException exception) {
            getLogger().severe("Could not install the WardenStrike advancement datapack: " + exception.getMessage());
            return false;
        }
    }

    private void copyResource(String resourcePath, Path target) throws IOException {
        Files.createDirectories(target.getParent());
        try (InputStream input = getResource(resourcePath)) {
            if (input == null) {
                throw new IOException("Missing plugin resource " + resourcePath);
            }
            Files.copy(input, target, StandardCopyOption.REPLACE_EXISTING);
        }
    }

    private void registerWardenRodRecipe() {
        Material dragonEgg = XMaterial.matchXMaterial("DRAGON_EGG").map(XMaterial::parseMaterial).orElse(null);
        Material fishingRod = XMaterial.matchXMaterial("FISHING_ROD").map(XMaterial::parseMaterial).orElse(null);
        Material sculkCatalyst = XMaterial.matchXMaterial("SCULK_CATALYST").map(XMaterial::parseMaterial).orElse(null);

        if (dragonEgg == null || fishingRod == null || sculkCatalyst == null) {
            getLogger().warning("Could not register the Warden Strike Rod recipe because an ingredient is unavailable.");
            return;
        }

        NamespacedKey recipeKey = new NamespacedKey(this, "warden_strike_rod");
        getServer().removeRecipe(recipeKey);
        ShapedRecipe recipe = new ShapedRecipe(recipeKey, WardenStrikeCommand.createWardenRod());
        recipe.shape(" D ", " R ", " C ");
        recipe.setIngredient('D', dragonEgg);
        recipe.setIngredient('R', fishingRod);
        recipe.setIngredient('C', sculkCatalyst);
        getServer().addRecipe(recipe);
    }

    @Override
    public void onDisable() {
        getLogger().info("WardenStrike has been disabled!");
    }
}