手冊: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