mohitnvrdie

Create a fully working Minecraft Paper 1.21.11 plugin called "Hunter" using Java 21.

Hunter is a custom one-use Crossbow homing missile weapon.

COMMAND:

  • /hunter gives the Hunter Crossbow.
  • Permission: hunter.admin
  • Default permission: OP.

HUNTER ITEM:

  • Base item: Crossbow
  • Name: ⚡ HUNTER | READY ⚡
  • Identify the Hunter using PersistentDataContainer.

Lore:

Projectile: [Arrow] ━━━━━━━━━━━━━━━━━━━━ ▌ Advanced Homing Missile System ▌ High-Speed Predictive Tracking Built for Elytra Interception ▌ Target Range: 50 Blocks Players & Entities ▌ Direct Line-of-Sight Required No Lock Through Blocks ▌ Left-Click to Lock Target Right-Click to Fire ▌ Load With Any Compatible Arrow ▌ One Hunter • One Missile

TARGET LOCK:

The Hunter can lock Players and LivingEntities up to 50 blocks away.

The player must directly aim at the target and LEFT-CLICK to lock it.

The target must have direct line-of-sight. Hunter must NEVER lock entities through walls or solid blocks.

When a target is successfully locked:

  • Make the target glow.
  • Spawn a Sonic Boom visual.
  • Play a fast "tun-tun-tun" note/pling sound.
  • Show a BossBar at the top ONLY to the shooter.

BossBar:

HUNTER | READY TO FIRE! | TARGET: <target name>

The BossBar must appear only after a successful lock, not simply by holding Hunter.

Left-click again should unlock the current target, remove the Hunter glow/BossBar and allow another target to be selected.

ARROW LOADING:

Hunter must work as a Crossbow for loading ammunition.

The player must load compatible Minecraft arrow ammunition before firing.

Support compatible normal, spectral and tipped arrows where supported by Paper.

The Hunter cannot launch its missile without ammunition.

FIRING:

After loading Hunter and locking a target, RIGHT-CLICK fires the missile.

IMPORTANT:

Use the actual Crossbow projectile firing event.

The projectile that Minecraft actually fires must become the Hunter missile.

Do not create a separate normal arrow plus a missile.

There must be only ONE projectile.

When the missile successfully launches:

  • Play fast "tun-tun-tun" launch feedback.
  • Start homing immediately.
  • The Hunter Crossbow is permanently used.
  • Remove the Hunter.
  • Replace it with the Hunter Cell.

Hunter is ONE USE only.

HOMING MISSILE:

The missile must be visible and physically fly through the world.

It must NOT teleport.

The missile should be very fast and continuously chase ONLY the original locked target.

Use predictive homing designed for Elytra interception.

The guidance system should use:

  • Target position
  • Target velocity
  • Missile position
  • Missile velocity
  • Distance to target

Predict where the moving target will be and steer toward that future interception point.

The missile should lead fast Elytra players instead of simply following their current position.

Update the missile guidance frequently/every tick while keeping movement smooth and fast.

Add a visible missile trail.

Maximum flight time should be approximately 15 seconds (300 ticks).

BLOCK COLLISION:

The missile must NEVER fly through solid blocks.

Because the missile is high-speed, use reliable collision detection so it cannot tunnel through walls between ticks.

If the missile hits a wall, floor, ceiling or another solid block:

  • Immediately remove the missile.
  • Do NOT destroy blocks.
  • Do NOT trigger the successful 5-block impact radius.

Result:

STATUS: NOT IMPACTED UNSUCCESSFULLY REASON: COLLIDED WITH BLOCK

OTHER FAILURE CONDITIONS:

If the missile hits another entity before the original locked target:

STATUS: NOT IMPACTED UNSUCCESSFULLY REASON: WRONG ENTITY HIT

If the target becomes unavailable:

STATUS: NOT IMPACTED UNSUCCESSFULLY REASON: TARGET LOST

If the missile exceeds its flight timeout:

STATUS: NOT IMPACTED UNSUCCESSFULLY REASON: MISSILE TIMEOUT

SUCCESSFUL IMPACT:

A Hunter shot is considered successful ONLY when the missile hits/reaches the ORIGINAL locked target.

On successful impact:

  • Spawn Sonic Boom visual effects.
  • Spawn explosion-style visual effects.
  • Do NOT destroy terrain.
  • Play an End Portal activation/spawn-style sound to EVERY online player on the server.

5-BLOCK IMPACT RADIUS:

After a successful original-target impact, create a spherical 5-block impact radius.

All applicable LivingEntities inside the radius receive:

  • Levitation for 5 seconds
  • Slow Falling for 5 seconds
  • Instant Damage II
  • Slowness for 5 seconds
  • Poison for 10 seconds

The radius activates ONLY after the original locked target is successfully hit.

A failed missile must never activate this radius.

TOTEM SYSTEM:

Hunter impact is lethal unless the affected entity has a valid Totem of Undying.

If an affected player/entity has a valid Totem of Undying in an appropriate hand:

  • Consume exactly ONE Totem.
  • Trigger the proper Totem activation/pop behavior using supported Paper API.
  • The entity survives.

If there is no valid Totem:

  • Kill the affected entity.

Do not use nonexistent Bukkit/Paper constants such as:

Effect.TOTEM_USED Effect.TOTEM_RESURRECT

Use only API methods/constants that actually exist in the targeted Paper version.

HUNTER CELL:

When Hunter successfully launches its missile, replace the used Hunter Crossbow with a Hunter Cell.

Hunter Cell base item:

PRISMARINE_CRYSTALS

It must specifically be Prismarine Crystals, NOT Prismarine Shard.

Use the normal vanilla Prismarine Crystals texture.

Give it a colorful custom name:

🌈 HUNTER CELL 🌈

The Hunter Cell is only a missile mission/status record.

It cannot fire another missile.

Associate the Cell with its individual shot using PersistentDataContainer.

CELL AFTER LAUNCH:

🚀 MISSILE: FIRED 🎯 TARGET: <target name> 👤 FIRED BY: <shooter name>

STATUS: IN FLIGHT

HUNTER USED!!

Make "HUNTER USED!!" bold dark red.

Do not display coordinates.

SUCCESS CELL:

When the ORIGINAL locked target is successfully hit, update the same Hunter Cell to:

🚀 MISSILE: FIRED 🎯 TARGET: <target name> 👤 FIRED BY: <shooter name>

STATUS: IMPACTED SUCCESSFULLY

HUNTER USED!!

FAILED CELL:

If the missile fails, update the same Cell to:

🚀 MISSILE: FIRED 🎯 TARGET: <target name> 👤 FIRED BY: <shooter name>

STATUS: NOT IMPACTED UNSUCCESSFULLY REASON: <failure reason>

HUNTER USED!!

Possible reasons:

  • COLLIDED WITH BLOCK
  • WRONG ENTITY HIT
  • TARGET LOST
  • MISSILE TIMEOUT

MULTIPLAYER:

Multiple players must be able to use Hunter at the same time.

Use UUID-based shot/target tracking.

Each shooter must have their own:

  • Target lock
  • BossBar
  • Missile
  • Shot UUID
  • Hunter Cell
  • Shot result

One Hunter must never interfere with another player's Hunter.

Clean up completed missile tasks and stored data correctly.

IMPORTANT BUG PREVENTION:

Do not repeat these previous bugs:

  1. Normal arrow fires straight instead of becoming a homing missile.
  2. Arrow fires but homing tracking never starts.
  3. Hunter remains in the player's inventory after firing.
  4. Hunter Cell does not appear after firing.
  5. A normal arrow and separate missile both spawn.
  6. Missile passes through walls.
  7. Missile only follows the target's current location and cannot intercept Elytra players.

The actual projectile fired by the Hunter Crossbow must be connected to the Hunter shot and homing system.

After a confirmed missile launch, the Hunter must reliably disappear and the PRISMARINE_CRYSTALS Hunter Cell must appear.

Make the complete Hunter system reliable and compatible with Paper 1.21.11 and Java 21.

Kodari AI
KodariOct 16 at 11:23 am 3
HunterHomingMissile
A Paper 1.21.11 plugin implementing a one-use homing missile crossbow. Players lock targets via left-click with line-of-sight checks, load arrows, and fire a single homing projectile that predicts Elytra movement. Features BossBar targeting, glow effects, 5-block impact radius with potion effects, Totem of Undying protection, and a persistent Hunter Cell tracking shot status. Uses UUID-based multiplayer tracking with proper cleanup.

Plan:

  1. Add the Java 21 Paper plugin entry point and /hunter command.

  2. Implement Hunter item identity, locking, shooter-only BossBar, and vanilla crossbow loading/firing.

  3. Guide the actual fired arrow with predictive steering, swept collision checks, and per-shot cell updates.

  4. Apply success-only impact effects and native Totem resurrection behavior; clean up locks and missile tasks.

Implemented the Hunter plugin with /hunter restricted by hunter.admin (OP by default).

  • Added the PDC-identified, one-use crossbow with vanilla arrow loading, target locking, shooter-only BossBar, glow, and lock feedback.

  • The actual arrow from the crossbow firing event becomes the missile. It steers predictively, checks swept paths for block/entity collisions, and updates its UUID-linked Hunter Cell with the result.

  • Successful hits alone trigger the visual effects, server-wide sound, 5-block effects, and vanilla Totem resurrection behavior.

Added plugin.yml, HunterPlugin.java, and HunterManager.java.

Kodari can make mistakes. Review important code before using.
Files
src
Code
3 762
src/main/java/com/kodari/hunter/HunterPlugin.java
package com.kodari.hunter;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Map;
import java.util.Objects;

public final class HunterPlugin extends JavaPlugin {
    private HunterManager hunterManager;

    @Override
    public void onEnable() {
        hunterManager = new HunterManager(this);
        Bukkit.getPluginManager().registerEvents(hunterManager, this);
        Objects.requireNonNull(getCommand("hunter")).setExecutor(this::giveHunter);
    }

    @Override
    public void onDisable() {
        if (hunterManager != null) {
            hunterManager.shutdown();
        }
    }

    private boolean giveHunter(CommandSender sender, Command command, String label, String[] args) {
        if (!sender.hasPermission("hunter.admin")) {
            sender.sendMessage("§cYou do not have permission to use this command.");
            return true;
        }
        if (!(sender instanceof Player player)) {
            sender.sendMessage("§cOnly players can receive the Hunter.");
            return true;
        }

        ItemStack hunter = hunterManager.createHunterItem();
        Map<Integer, ItemStack> leftovers = player.getInventory().addItem(hunter);
        leftovers.values().forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
        player.sendMessage("§aYou received the §eHunter§a.");
        return true;
    }
}