Skip to content

Execute Command

Executes a command.

Type ID: kaya:execute_command

Warning

This type is server-side only.

Format

Field Type Default Description
source Command Source Provider The command source to use for executing the command.
command String Provider The command to execute.

Example

{
    "type": "kaya:execute_command",
    "source": "server",
    "command": {
        "type": "kaya:weighted",
        "entries": [
            {
                "value": "say Hello world!",
                "weight": 1
            },
            {
                "value": "execute at @e run summon lightning_bolt",
                "weight": 1
            },
            {
                "type": "give @a diamond",
                "weight": 1
            }
        ]
    }
}

This example will execute one of the three commands picked at random with $33.33...\%$ chance each:

  • The server will output "Hello world!"
  • A lightning bolt will be summoned at all entities currently loaded.
  • All players will be given a diamond.

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.