Develop a Minecraft plugin called RandomKitZone using Java for Paper 1.21 server API.
PLUGIN OVERVIEW
The plugin creates a region zone system where players receive random kit items when entering the zone.
The plugin must behave according to the following rules.
ZONE ENTRY LOGIC
When a player enters the defined zone:
- Player must receive kit items only once per zone entry.
- Kit items must be given only if the target inventory slot is empty.
If a slot already contains an item:
Then that slot must be skipped and kit item must not be given to that slot.
Other slots that are empty must still receive kit items.
- Player must not receive kit again while staying inside the zone.
- When player leaves the zone:
- Player inventory items must remain exactly the same.
- No item removal or modification should happen.
- When player re enters the zone, kit logic must run again.
- Zone state must be cached per player to prevent repeated kit distribution.
- Player must hear a short soft sound when kit is successfully given.
Do not send messages to players about permissions, errors, or plugin internal logic.
---
COMMAND SYSTEM
Main command: /rkit
Subcommands:
/rkit create zoneName x1 y1 z1 x2 y2 z2 Creates a new zone region.
Two block coordinates must be stored.
---
/rkit delete zoneName Deletes zone region.
---
/rkit add zoneName slot Adds the item currently held by the player into kit configuration.
Rules:
The plugin must read the item the player is holding.
The slot can be hotbar slots 1 to 9 or armor slots including helmet, chestplate, leggings, and boots.
The slot position must be selectable regardless of where the item is stored in inventory.
---
/rkit remove zoneName slot Removes item configuration from specified slot.
---
ENCHANTMENT SYSTEM
Command: /rkit enchant zoneName slot itemName(ex NETHERITE_SWORD) enchantName chance(optional)
Features:
- Player can add enchantments to items.
- Supported enchantments must use Minecraft registry enchantment names.
- Tab completion must show valid enchantment names and item material names.
- Enchantment probability system must work as follows:
If enchantment chance is not specified:
Then distribute probability automatically.
Example logic:
If one enchantment exists in that slot:
Chance must be 100 percent.
If multiple enchantments exist:
Automatically balance probability among them.
If player specifies chance value:
Use the given chance.
---
SPECIAL ENCHANT KEYWORD
If enchantment name is NONE:
Then item must be given without any enchantments.
---
KIT EDIT SYSTEM
Command: /rkit edit zoneName
This command allows modification of:
Item probability values.
Enchantment probability values.
Add enchantments.
Remove enchantments.
Adjust existing configuration probabilities.
Player must be able to:
- Change enchantment chance.
- Delete enchantments.
- Adjust item chance.
---
LIST SYSTEM
Command: /rkit list
Must display:
Zone name Slot information Item material Enchantments Probability values
---
RELOAD SYSTEM
Command: /rkit reload
Reload plugin configuration files.
---
PERMISSION SYSTEM
Admin permission node:
randomkitzone.admin
Important rules:
If player lacks permission:
Do not send permission error messages.
Plugin must silently ignore unauthorized commands.
---
TAB COMPLETION SYSTEM
Implement proper tab completion support for:
Commands Zone names Slot numbers Material registry names Enchantment registry names
---
DATA STORAGE
Use YAML or JSON file storage.
All zone configurations must persist after server restart.
Support asynchronous file input output if possible.
---
REGION DETECTION PERFORMANCE
Region entry detection must be optimized.
Use cached player zone state.
Avoid checking region boundaries unnecessarily.
Use lightweight event listener logic.
---
BUG PREVENTION REQUIREMENTS
Prevent:
Null pointer exceptions.
Item duplication.
Repeated kit distribution while player is inside zone.
Kit distribution when inventory slot is occupied.
Inventory overwrite.
---
OUTPUT REQUIREMENT
Generate production level code including:
Plugin architecture Command system Event listeners Configuration manager Region detection logic Tab completion system Maven or Gradle build configuration
The plugin must be fully compatible with Paper 1.21 server.
Output must be fully compilable and ready to run.