Mechanic
command
Executes a command
Aliases
cmd
Configuration Fields (5)
| Name | Type | Default | Description |
|---|---|---|---|
| command cmd, c | PlaceholderString | — | The command to execute |
| asCaster caster, ac, sudo, asmob | boolean | false | Whether to execute the command as the caster of the skill |
| asTarget target, at, sudotarget | boolean | false | Whether to execute the command as the targeted entity of the skill |
| requireTarget rt | boolean | false | Execute the command if the skill has a target |
| asOp op | boolean | false | Whether to execute the command with all permissions |
Examples & Notes
Examples
Correctly written command-skills
Skills:
- command{c="give <target.name> gold_ingot 20"} @trigger ~onInteract
- command{c="minecraft:tp <target.name> <mob.uuid>"} @self ~onDamaged
- command{c="say HELLO <target.name>";asTarget=true;asOp=true} @NearestPlayer{r=10}
Invalid command-skills
The below example(s) won’t work because certain symbols haven’t been substituted with message variables.
Skills:
- command{c="minecraft:summon Zombie ~ ~ ~ {NoAI:true,CustomName:"Summoned Zombie"}"}
In this specific case, the
~symbol is a problem: while normally, in vanilla, it would just mean “the position of the one that is executing the command”, this is not possible with this specific setup, as it is the console that is executing the command, and as such there is no “position” that can be used. A way to fix this would have been to use the<caster.l.x>,<caster.l.y>and<caster.l.z>placeholders
Making a player execute a command
This example will execute the “say” commands for the player that interacted with the mob
ExampleMob:
Type: ZOMBIE
Skills:
- command{c="say <target.name>";asTarget=true;asOp=true} @trigger ~onInteract
Universal Mechanic Options
- Author:
- Ashijin
