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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- Gift Claim Effects
When a player right-clicks a valid gift:
- Verify the event is active.
- Verify the block belongs to the current event.
- Atomically mark the gift as claimed to prevent duplicate rewards.
- Execute the reward command assigned to that gift.
- Remove the gift block safely.
- Send a colorful chat confirmation showing the gift number and remaining gifts.
- Update the BossBar and leaderboard.
- Play a configurable success sound.
- Spawn green emerald-style particles resembling the villager trade effect.
Use a reasonable particle count and spread. Do not spam particles or sounds.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.