RandomCommand — Documentation
Directory Structure
After the first run, the plugin generates:
plugins/RandomCommand/
├─ config.yml # Main configuration
└─ random/ # Folder containing random groups
├─ crates.yml # Example group: "crates"
└─ drops.yml # Example group: "drops"
⚙️ Configuration — config.yml
debug: false # true = print detailed debug info in console when executing
allow-self-target: true # Allow running /random <group> without specifying a player (targets yourself)
messages:
no-group: "&cGroup &f{group}&c does not exist!"
no-player: "&cYou must specify a player!"
not-player: "&cYou are not a player. Please specify a player."
executed: "&aExecuted group &f{group}&a for &f{player}&a."
reloaded: "&aConfiguration reloaded!"
nothing: "&eGroup &f{group}&e has no valid entries."
default-execute-as: CONSOLE # CONSOLE or PLAYER
Creating a Random Group
Each
.yml file in the random/ folder is a
group.
The group name is the file name without .yml.
Structure example:
entries:
- weight: 50 # Weight (relative chance)
as: CONSOLE # CONSOLE or PLAYER (optional, default from config.yml)
commands:
- "give {player} minecraft:diamond 1"
- "tell {player} You have received a diamond!"
- weight: 30
commands:
- "eco give {player} 500"
- weight: 20
commands:
- "give {player} minecraft:golden_apple 3"
Notes:
weight: The chance weight. The plugin calculates the probability based on the total weight of the group.
as
:
- CONSOLE: Command runs as the server console (bypasses permissions).
- PLAYER: Command runs as the targeted player.
commands: List of commands.
{player} will be replaced with the target player’s name
Commands:
- /random <group> [player] | Runs the random group. If no player is given, targets yourself (if allow-self-target: true) | random.use
- /random reload | Reloads config.yml and all group files in /random/ | random.reload
️ Permissions:
random.use:
default: true
random.reload:
default: op
Examples:
1. Random Crate Rewards:
File: (random/crates.yml)
entries:
- weight: 50
commands:
- "give {player} minecraft:iron_ingot 10"
- weight: 30
commands:
- "give {player} minecraft:diamond 1"
- weight: 20
commands:
- "give {player} minecraft:netherite_ingot 1"
Run:
Run:
/random crates
2. Buff Another Player:
File: (random/buffs.yml)
entries:
- weight: 70
as: PLAYER
commands:
- "effect give {player} minecraft:regeneration 10 1 true"
- weight: 30
commands:
- "effect give {player} minecraft:speed 15 2 true"
Run:
Run:
/random buffs PlayerName
Tips:
- You can create unlimited groups — just add more .yml files to the random/ folder.
- Total weight does not need to be 100 — the plugin calculates the percentage automatically.
- Enable debug: true in config.yml to see detailed logs of what was selected and executed
- Use {player} to call player name in this plugin.