手册:run_command

来自Minecraft基岩版开发Wiki
数据驱动 物品 > run_command
run_command
附加包物品事件响应
组件所属
组件类型
1.16.100
加入版本

在事件中执行命令

模式[编辑]

object "run_command" : opt
{
	array "command"
	{
		string "<any array element>"
	}
	string "command"
	enumerated_value "target"<"self","other","player","target","parent","baby","block","damager","holder","item"> : opt
}

结构[编辑]

  •  run_command:根对象。
    • *command:设置要执行的命令,不包含前缀斜杠。
    •  target:设置命令的执行者。可选值为"self"、​"other"、​"player"、​"target"、​"parent"、​"baby"、​"block"、​"damager"、​"holder""item",默认值为"self"

示例[编辑]

"run_command": {
	"command": [
		"say Hello world!",
		"tellraw @a {\"rawtext\":[{\"text\":\"[\"},{\"selector\":\"@s\"},{\"text\":\"] Hello world!\"}]}"
	],
	"target": "self"
}

历史[编辑]

基岩版
1.16.1001.16.100.56加入了run_command

漏洞[编辑]

关于run_command的漏洞在国际版中由漏洞追踪器维护,请在此报告漏洞。

参考[编辑]

Block Documentation - run_command  — Microsoft Learn