crafty_yt.
📎 1 file 3,494 chars
📄
pasted-code-1793212448691.txt
txt 85 lines
▶
Create a complete Minecraft Paper plugin for version 1.21.11 called "RandomKits".

Requirements:

1. Core functionality:
- When a player dies and respawns, automatically give them a completely new random kit.
- The kit is applied immediately on respawn (PlayerRespawnEvent).

2. Kit contents (all configurable):
- Armor: any full set possible (leather, chainmail, iron, gold, diamond, netherite). Randomly choose one full set and equip it.
- Main weapon (hotbar slot 0): any weapon (wooden/stone/iron/gold/diamond/netherite sword, axe, pickaxe, shovel, hoe, trident, mace, bow, crossbow, spear if available, etc.).
  - Special rule: if the chosen weapon is a mace, also give 64 wind charges.
- Food items: any food (cooked beef, golden carrot, golden apple, enchanted golden apple, bread, cooked porkchop, etc.).
- Offhand item: totem of undying, shield, or any other useful offhand item.
- Additional items: arrows, fireworks, potions, ender pearls, etc. (fill remaining hotbar slots).

3. Equipment logic:
- Armor is equipped automatically.
- Main weapon goes into hotbar slot 0.
- Offhand item goes into the offhand slot.
- All other items fill the remaining hotbar slots (1-8).
- Clear the player's inventory before giving the new kit (optional, configurable).

4. Configuration (config.yml):
Must be fully configurable with these sections:

kits:
  armor-sets: list of material names that form full sets (e.g. NETHERITE, DIAMOND, IRON...)
  weapons: list of possible main weapons (Material names)
  foods: list of possible food items
  offhand-items: list of possible offhand items
  extra-items: list of additional items that can appear in hotbar

item-slots:
  main-weapon: 0
  # possibility to force specific items into specific slots

amounts:
  food-amount: min-max range
  extra-item-amount: min-max
  wind-charges-if-mace: 64

settings:
  clear-inventory-on-kit: true/false
  give-kit-on-first-join: true/false
  give-kit-only-on-death: true
  enable-respawn-effect: true

respawn-effect:
  enabled: true
  sound: ENTITY_PLAYER_LEVELUP (or any Sound enum)
  sound-volume: 1.0
  sound-pitch: 1.0
  particles:
    - type: TOTEM_OF_UNDYING
      count: 50
      offset: 0.5
    - type: FIREWORK
      count: 30
  # ability to add/remove multiple particles

All lists must support easy add/remove by editing config. Use Material and Sound enums properly for 1.21.11.

5. Commands:
- /randomkits reload
- /randomkits give  (force give a random kit)
- Permission: randomkits.admin

6. Technical requirements:
- Use Paper API 1.21.1+ (or exact 1.21.11 compatible)
- Proper event handling (PlayerRespawnEvent, PlayerDeathEvent if needed)
- Async-safe where possible
- Clean code structure (Main class, KitManager, ConfigManager, EffectManager)
- No hardcoded items – everything from config
- Support for custom items if possible via Material
- Handle edge cases (player in creative, already has items, etc.)

7. Extra polish:
- When the kit is given, play the configured sound + particles at the player's location.
- Make the effect toggleable.
- Make it configurable so when the effect plays other players see/hear the particles/soundeffects or not.
- Nice messages (configurable) when receiving a kit.
- Soft-depend on nothing, pure Paper plugin.

Generate the full working plugin: plugin.yml, config.yml (with good defaults including all common sets, weapons, foods, offhands), and all Java classes. Make the code clean, well-commented, and ready to compile with Maven or Gradle.
Kodari AI
KodariOct 28 at 6:38 pm 1
RandomKits
A Paper plugin that automatically assigns players a completely random kit upon respawn or first join. Each kit includes a randomly selected full armor set, a main weapon placed in hotbar slot 0 with special handling for maces granting wind charges, food items, an offhand item, and additional items filling remaining hotbar slots. All kit contents are fully configurable through config.yml with lists of Material names for armor sets, weapons, foods, offhand items, and extras. Features configurable item slot assignments, item amounts with min-max ranges, inventory clearing before kit application, toggleable respawn effects with configurable sounds and multiple particle types, and admin commands for reloading config or forcing kits on specific players. Includes nice configurable messages when kits are received.
  • Create the Paper plugin entry point, config, and command/listener wiring.

  • Implement configurable random kits, respawn handling, and visible/owner-only effects.

  • Add plugin metadata and sensible 1.21 defaults.

Created RandomKits with configurable armor, weapons, food, offhand items, forced hotbar slots, and effects. Kits are applied after respawn; automatic kits skip creative players, while /randomkits give <player> can force one. /randomkits reload reloads the config, and both commands require randomkits.admin.

Defaults include the common tool and weapon tiers plus spear material names; entries unsupported by the server’s material matcher are skipped.

crafty_yt.

Make it so every piece of armor randomizes differently so like leather boots, diamond helmet leather chestplate, and make it so you only get one kind of food 64 of a random kind of foot. make it so you only get one king of random items, not more 1 kind

Kodari AI
KodariOct 28 at 6:46 pm 1
  1. Randomize each armor slot independently from the configured armor tiers.

  2. Give one food type as a 64-item stack and only one selected extra-item type per kit.

Updated KitManager: each armor piece now randomly selects its tier independently. Each kit gets one randomly chosen food type (64 items) and one randomly chosen extra-item type; the existing extra-item amount settings still apply.

crafty_yt.

make it so i can type a number after each item so i can only get that amount of that item/block in config, and make it so i can tyoe - or + like this

  • golden_apple 4 +

this makes it so i must get 4 golden apple (4) every time (+) and

  • golden_apple - this makes it so i get the amoint between the min and max setting (no number) and there is a random chance of me getting this (-)
Kodari AI
KodariOct 30 at 9:07 pm 1
  1. Add per-entry item rules: fixed amount with +, or weighted/random amount using - and configured min/max.

  2. Update the example config to demonstrate both formats.

[Generation stopped]

crafty_yt.

i meant like the number i type after the item/block is the only amount i can get of that and the + and - is: + = i must get that item every time and

  • = there is a chance that i can get that item
Kodari AI
KodariOct 30 at 9:12 pm 1
  1. Parse entries as MATERIAL AMOUNT + (guaranteed) or MATERIAL AMOUNT - (optional).

  2. Keep one selected weapon/offhand and at most one optional food/extra type; grant all explicitly required food/extra entries.

  3. Update defaults and add a configurable chance for optional entries.

Item entries now use MATERIAL AMOUNT + or MATERIAL AMOUNT -. + guarantees the item; - makes one randomly selected optional entry eligible at the configured chance (settings.optional-item-chance, default 50%). Food and extra lists grant every + entry and at most one optional entry each. Weapon and offhand slots can hold only one choice, so they select one guaranteed entry if available, otherwise one optional entry. Stack amounts are capped at the material’s maximum stack size.

Kodari can make mistakes. Review important code before using.
Files
src
Code
8 582
src/main/java/com/kodari/randomkits/RandomKitsPlugin.java
package com.kodari.randomkits;

import com.kodari.randomkits.command.RandomKitsCommand;
import com.kodari.randomkits.config.ConfigManager;
import com.kodari.randomkits.effect.EffectManager;
import com.kodari.randomkits.kit.KitManager;
import com.kodari.randomkits.listener.RandomKitsListener;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class RandomKitsPlugin extends JavaPlugin {
    private ConfigManager configManager;
    private EffectManager effectManager;
    private KitManager kitManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        configManager = new ConfigManager(this);
        effectManager = new EffectManager(configManager);
        kitManager = new KitManager(this, configManager, effectManager);

        Bukkit.getPluginManager().registerEvents(new RandomKitsListener(this, configManager, kitManager), this);
        getCommand("randomkits").setExecutor(new RandomKitsCommand(this, configManager, kitManager));
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public KitManager getKitManager() {
        return kitManager;
    }
}