Plugin basics
Minecraft kits plugin: cooldowns, permissions and config
How a kits plugin should work: kits defined in config.yml, one permission per kit, cooldowns that survive restarts, and a prompt to generate it.
A kit is a set of items a player can claim, usually with a delay before it can be claimed again. Kits are a good fit for AI generation because everything about them is data you can describe.
Define kits in config, not code
kits:
starter:
cooldown-seconds: 86400
items:
- "STONE_SWORD:1"
- "COOKED_BEEF:16"
vip:
cooldown-seconds: 43200
items:
- "DIAMOND_PICKAXE:1"
- "GOLDEN_APPLE:4"With kits in the file you can add a new one at any time without a new plugin build. Ask for item names that match your Minecraft version, because material names changed in 1.13.
One permission per kit
Use a node such as kits.starter and kits.vip, then grant them to ranks with a permissions plugin. The /kit list command should only show kits the player is allowed to claim.
Cooldowns that survive restarts
Cooldowns kept only in memory reset when the server restarts, which lets players claim a daily kit by waiting for a reboot. Ask for the time of the last claim to be saved in a data file.
What happens when the inventory is full
Decide it up front. Options are dropping the leftover items at the player's feet, refusing the claim without starting the cooldown, or giving the rest later. Refusing without a cooldown is the friendliest.
Extras that are easy to add later
- A preview menu before claiming.
- One-time kits that can be claimed only once per player.
- A price in money instead of a cooldown.
- Different kits for first join.
A sample kit setup for a survival server
- starter: a wooden set and some bread, claimable once a day.
- builder: stone blocks and a pickaxe, claimable once a week.
- vip: better tools and a few golden apples, with a shorter cooldown.
- staff: a kit with no cooldown for moderators.
Testing the cooldown
Set the cooldown to ten seconds while you test. Claim a kit, try again at once, wait and claim again. Restart the server in between to make sure the cooldown is remembered. When it works, set the real values in config.yml.
Frequently asked questions
Can a kit include named or enchanted items?
Yes, if you describe them in the prompt, for example "a diamond sword named Guard Blade with sharpness 3".
What about kits for the first join?
Ask for a one-time kit that is given automatically when a player joins for the first time.
Can players preview a kit?
Yes. Ask for a menu that shows the items without giving them.