notnagi.gg

Build a Complete Minecraft Gift Hunt Plugin

Act as an expert Minecraft Java Plugin Developer. Develop a complete, production-ready Minecraft Gift Hunt plugin based on the requirements below.

  1. Technology Stack
  • Java 21
  • Paper API 1.21.11+
  • Maven project
  • Adventure API for chat messages, titles, subtitles and BossBars
  • Persistent YAML configuration and player statistics
  • Plugin name: "GiftHunt"
  • Main package: "net.gifthunt"
  • Do not use Skript or require any Skript plugin.

Deliver a complete, compilable Maven project with all source files and resources.

  1. Commands and Arena Management

Implement these commands:

  • "/gifthunt wand" — Give the player the special arena-selection wand.
  • "/gifthunt pos1" — Set Position 1 at the player's current block location.
  • "/gifthunt pos2" — Set Position 2 at the player's current block location.
  • "/gifthunt create <name>" — Create an arena using the selected corners.
  • "/gifthunt amount <name> <amount>" — Set the number of gifts in an arena; default: 50.
  • "/gifthunt budget <amount>" — Add a console reward command to the reward pool.
  • "/gifthunt rewards" — List configured reward commands.
  • "/gifthunt rewardremove <id>" — Remove a reward command by its ID.
  • "/gifthunt prep <name> <0|5|10|15|30>" — Prepare an event with a countdown.
  • "/gifthunt start <name>" — Start the event immediately.
  • "/gifthunt stop <name>" — Stop an active event.
  • "/gifthunt end <name>" — End the event and clean up.
  • "/gifthunt leaderboard <name>" — Show the top 10 players.
  • "/gifthunt info <name>" — Show arena settings and event status.
  • "/gifthunt delete <name>" — Delete an arena.
  • "/gifthunt reload" — Reload the configuration.

Provide tab completion, proper argument validation and helpful error messages. Restrict management commands to authorized administrators.

  1. Special Arena Selection Wand

The "/gifthunt wand" command must give the player a special Diamond Axe.

Requirements:

  • Material: Diamond Axe.
  • Apply Efficiency V internally.
  • Hide all enchantment information in the item tooltip so the enchantment is not visibly displayed.
  • Display name: "&6&lGift Hunt Wand".
  • Lore: "&7Left-click: Set Position 1" and "&7Right-click: Set Position 2".
  • Identify the wand using PersistentDataContainer and a plugin-specific NamespacedKey.
  • Ordinary Diamond Axes must never work as selection wands.
  • Left-clicking a block with the wand selects Position 1.
  • Right-clicking a block with the wand selects Position 2.
  • Cancel normal block breaking, block interaction and unwanted axe behavior while using the wand.
  • Display the selected world and X, Y, Z coordinates in chat.
  • "/gifthunt pos1" and "/gifthunt pos2" must also work without the wand by selecting the player's current block location.
  • Store each player's selections independently.
  • Both positions must belong to the same world before an arena can be created.
  • Validate the selected region and prevent invalid or excessively large arenas.

Use the correct Paper API item metadata flags to hide enchantment details without removing the enchantment itself.

  1. Arena Creation and Gift Placement

When "/gifthunt create <name>" is executed:

  • Validate both selected corners.
  • Save the arena name, world and coordinates persistently.
  • Support multiple independent arenas.
  • Use 50 gifts by default.
  • Allow administrators to change the amount with "/gifthunt amount <name> <amount>".
  • Generate gift locations randomly within the selected cuboid.
  • Never place multiple gifts at the same location.
  • Select safe, accessible positions and avoid lava, water, solid occupied spaces and invalid locations.
  • Handle slabs, stairs and uneven terrain appropriately.
  • Do not modify unrelated arena blocks.
  • If insufficient safe locations exist, report the actual number placed and do not claim that all gifts were successfully created.

Use a recognizable gift block, preferably a barrel, with a custom name and persistent metadata. Only plugin-created gift blocks should be claimable.

  1. Reward Command System

The "/gifthunt budget <amount>" command configures a reward command. The argument represents a console command, not a numeric currency budget or an item quantity.

Example:

"/gifthunt budget eco give %player% 500"

Rules:

  • Store the command without a leading "/".
  • Support commands containing spaces and arguments.
  • Replace "%player%" with the username of the player who claims the assigned gift.
  • Execute the configured command through the server console.
  • Do not execute commands supplied by ordinary players.
  • Allow administrators to configure multiple reward entries.
  • Give each gift box exactly one randomly selected reward entry from the configured pool.
  • Assign the reward when generating gifts and keep it fixed for that gift throughout the event.
  • Each successful claim must execute its assigned reward exactly once.
  • Prevent duplicate claims, rapid-click exploits and duplicate reward execution.
  • If the reward pool is empty, do not start the event. Show an informative error message.
  • Do not add any default reward commands.

The "amount" argument in "/gifthunt budget <amount>" must contain the reward command, while "/gifthunt amount <name> <amount>" controls gift quantity.

Provide safe reward parsing and clear feedback when a reward command is invalid.

  1. Event Preparation and Countdown

Implement "/gifthunt prep <name> <0|5|10|15|30>".

Allowed countdown values are exactly 0, 5, 10, 15 and 30 seconds.

During preparation:

  • Broadcast a chat message that the event countdown has started.
  • Display a BossBar with the remaining countdown.
  • Show prominent title countdown numbers during the final seconds.
  • At zero, announce the start and activate all gifts.
  • If countdown is zero, start immediately.
  • Prevent multiple overlapping events in the same arena.
  • Handle cancellation and server shutdown safely.
  1. BossBar — Match the Reference Screenshots

Recreate the visual behavior shown in the provided Gift Hunt screenshots.

During preparation, show a title similar to:

"GIFT HUNT » Starting in 30s..."

During the active event, display:

"GIFT HUNT » 0/50 Claimed"

Update the BossBar immediately when a gift is claimed. Display claimed and remaining gifts, for example:

"GIFT HUNT » 12/50 Claimed | 38 Left"

Requirements:

  • Use a configurable BossBar color and overlay.
  • Progress must reflect countdown time during preparation.
  • Progress must reflect the claimed-gift ratio during the active event.
  • Use Adventure BossBar or the appropriate Paper API.
  • Show the BossBar to online event participants.
  • Update it for players who join while the event is running.
  • Remove the BossBar when the event ends, is stopped or is cancelled.
  • Avoid duplicate BossBars and memory leaks.
  1. Chat Messages and Titles

Use a consistent, configurable "GIFT" prefix with colorful Minecraft formatting.

Provide configurable messages similar to these examples:

  • "GIFT » Position 1 selected at X, Y, Z."
  • "GIFT » Position 2 selected at X, Y, Z."
  • "GIFT » Arena <name> created successfully."
  • "GIFT » Preparation countdown for <name> set to 30s."
  • "GIFT » Event <name> countdown started (30s)."
  • "GIFT » Good luck, and happy hunting!"
  • "GIFT » LET'S GO! Find hidden gifts across the map!"
  • "GIFT » <player> claimed Gift #<number>! <claimed>/<total> claimed, <remaining> remaining."
  • "GIFT » ALL GIFTS CLAIMED! All gifts have been collected!"
  • "GIFT » GIFT HUNT TIME IS UP!"
  • "GIFT » No more gifts can be collected."

Important:

  • Claim confirmation must appear in normal chat, not the action bar.
  • Use titles and subtitles for the countdown and event start.
  • Make messages configurable in "config.yml".
  • Ensure placeholders are replaced correctly.
  1. Gift Claim Effects

When a player right-clicks a valid gift:

  1. Verify the event is active.
  2. Verify the block belongs to the current event.
  3. Atomically mark the gift as claimed to prevent duplicate rewards.
  4. Execute the reward command assigned to that gift.
  5. Remove the gift block safely.
  6. Send a colorful chat confirmation showing the gift number and remaining gifts.
  7. Update the BossBar and leaderboard.
  8. Play a configurable success sound.
  9. Spawn green emerald-style particles resembling the villager trade effect.

Use a reasonable particle count and spread. Do not spam particles or sounds.

  1. Sounds and Visual Effects

Make sound effects configurable.

Suggested defaults:

  • Countdown start: "BLOCK_NOTE_BLOCK_PLING"
  • Final countdown: "BLOCK_NOTE_BLOCK_HAT"
  • Event start: "ENTITY_PLAYER_LEVELUP"
  • Successful claim: "ENTITY_VILLAGER_YES"
  • Rare reward notification: "UI_TOAST_CHALLENGE_COMPLETE"
  • Event completion: "UI_TOAST_CHALLENGE_COMPLETE"
  • Event cancellation: "BLOCK_ANVIL_LAND"

Allow sound volume and pitch to be configured. Validate sound names and fall back safely when invalid.

Use green particles for successful gift claims and configurable titles for the start and completion announcements.

  1. Event Duration and Completion

Support a configurable event time limit.

When time expires:

  • Stop accepting new claims.
  • Announce that the event time has expired.
  • Report the number of gifts claimed and remaining.
  • Remove the BossBar.
  • Clean up remaining plugin-created gift blocks without altering unrelated blocks.
  • Save statistics and event state safely.

If all gifts are claimed before the time limit, announce that the event is complete and perform the same cleanup.

Stopping an event manually must not issue rewards for unclaimed gifts.

  1. Leaderboard and Statistics

Implement:

"/gifthunt leaderboard <name>"

Display the top 10 players ranked by the number of gifts they claimed during the relevant event or arena, using a clearly documented ranking rule.

Include:

  • Rank
  • Player name
  • Gifts claimed
  • Percentage of total gifts, where applicable

Persist player statistics across restarts. Prevent duplicate entries and sort the results correctly.

  1. Configuration Files

Create a complete "config.yml" containing:

  • Default gift amount: 50
  • Event time limit
  • Countdown options
  • BossBar title, color and overlay
  • Chat prefix and messages
  • Titles and subtitles
  • Sounds, volume and pitch
  • Particle settings
  • Gift block material and display name
  • Arena size limits
  • Reward pool settings
  • Leaderboard options

The reward pool must be empty by default.

Store arenas in a separate YAML file if appropriate. Save player statistics and event information persistently.

  1. Permissions and Security

Create:

  • "gifthunt.admin" — Manage arenas, rewards and events.
  • "gifthunt.use" — Participate in events.
  • "gifthunt.leaderboard" — View leaderboards.

Declare permissions and commands in "plugin.yml".

Validate all command arguments, arena names, world references and reward commands. Prevent unauthorized command execution, gift duplication, invalid block interactions and overlapping event states.

  1. Project Deliverables

Provide:

  • Complete Java source code
  • "pom.xml"
  • "plugin.yml"
  • "config.yml"
  • Any required additional YAML files
  • "README.md" with installation, setup, commands, permissions and reward examples

The final project must compile successfully using:

"mvn clean package"

Do not provide pseudocode, incomplete methods, fake implementations or omitted files. Review the entire project for compilation errors, incorrect Paper API usage, event-handling bugs, reward duplication and cleanup issues before delivery.

Build the complete working plugin, not merely a tutorial or explanation.

Kodari AI
KodariOct 13 at 11:48 am 35
GiftHunt
GiftHunt is a comprehensive Minecraft plugin for Paper 1.21 that creates interactive gift-hunting events. Administrators use a special diamond axe wand to select arena regions, configure gift quantities, and manage reward command pools. The plugin generates randomly placed gift barrels with persistent metadata, runs countdown-based events with BossBar progress tracking, and executes console reward commands when players claim gifts. It features configurable sounds, particles, titles, and messages, plus persistent player statistics and leaderboards. The system prevents duplicate claims, validates regions, and safely cleans up event blocks.

I’ll verify one Bukkit API detail before writing the files: whether barrel block states expose setCustomName.

I’ll create the full Maven project in one pass. Gifts are placed at create, amount and prep, so the placed count is reported each time.

The project files are in. I accidentally added a stray placeholder file at the end of that patch, so I’m removing it now.

The GiftHunt plugin is written as a complete Maven project under package net.gifthunt. I have not compiled it. The one API detail I checked was the Paper 1.21.11 snapshot version and that org.bukkit.block.Nameable exists. Compile it in Kodari: click Compile in the top bar, then Compile in the window, and download GiftHunt.jar.

What’s in the project

  • pom.xml (Java 21, paper-api 1.21.11-R0.1-SNAPSHOT), plugin.yml, config.yml, README.md.

  • Wand: a Diamond Axe with Efficiency V and HIDE_ENCHANTS, identified by a PDC key. Left-click sets pos1, right-click sets pos2. Breaking, damaging and entity interaction are cancelled while holding it.

  • Arenas, selections and rewards are stored per player and in YAML files. Gift positions are persisted so old gifts can be cleaned up after a restart.

  • Gifts are barrels with a PDC marker. They are placed on air with a free block above and a solid, full-block support below. Slabs, stairs, walls, fences, liquids and lava are excluded.

  • Rewards are assigned per gift when it is generated. Each claim marks the gift claimed before running the command, so it runs once. %player% is replaced, and the command runs from the console.

  • The countdown and BossBar follow the spec. Sounds fall back to defaults when a name is invalid. Claims emit HAPPY_VILLAGER particles.

  • stop issues no rewards and leaves gift blocks in place. end, time-up and completion remove the remaining gift blocks. Shutdown ends active events without rewards.

  • The leaderboard counts claims per arena across events. Percentage is claims divided by all gifts placed in that arena.

Decisions you may want to change

  • Gifts are placed at create, amount and prep. Each time, the real placed count is reported, and a shortfall is flagged. prep regenerates gifts so the reward pool is current.

  • Rare gifts are a random flag (rewards.rare-chance, default 10%). The spec did not define what makes a reward rare.

  • delete is refused while an event runs on that arena. Stats are kept after deletion.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
20 2,243
src/main/java/net/gifthunt/GiftHuntPlugin.java
package net.gifthunt;

import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class GiftHuntPlugin extends JavaPlugin {

    private Feedback feedback;
    private ArenaManager arenaManager;
    private RewardManager rewardManager;
    private StatsManager statsManager;
    private GiftManager giftManager;
    private SelectionManager selectionManager;
    private WandManager wandManager;
    private EventManager eventManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        feedback = new Feedback(this);
        arenaManager = new ArenaManager(this);
        rewardManager = new RewardManager(this);
        statsManager = new StatsManager(this);
        giftManager = new GiftManager(this);
        selectionManager = new SelectionManager();
        wandManager = new WandManager(this, feedback);
        eventManager = new EventManager(this, feedback, arenaManager, giftManager, rewardManager, statsManager);

        PluginCommand pluginCommand = getCommand("gifthunt");
        if (pluginCommand == null) {
            getLogger().severe("Command 'gifthunt' is missing from plugin.yml; disabling GiftHunt.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        GiftHuntCommand command = new GiftHuntCommand(this);
        pluginCommand.setExecutor(command);
        pluginCommand.setTabCompleter(command);

        getServer().getPluginManager().registerEvents(new WandListener(this), this);
        getServer().getPluginManager().registerEvents(new GiftListener(this), this);
    }

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

    public void reloadPluginConfig() {
        reloadConfig();
        arenaManager.load();
        rewardManager.load();
    }

    public Feedback getFeedback() {
        return feedback;
    }

    public ArenaManager getArenaManager() {
        return arenaManager;
    }

    public RewardManager getRewardManager() {
        return rewardManager;
    }

    public StatsManager getStatsManager() {
        return statsManager;
    }

    public GiftManager getGiftManager() {
        return giftManager;
    }

    public SelectionManager getSelectionManager() {
        return selectionManager;
    }

    public WandManager getWandManager() {
        return wandManager;
    }

    public EventManager getEventManager() {
        return eventManager;
    }
}