• 金粒不够用?看这里!全面详细的金粒获取方式!【内有红包】
  • MineBBS 2022年国庆Mini建筑赛要来啦!奖励丰富,快来看看!【点我围观】
Resource icon

Uncategorized Command Parser API 1.0.1

Source of resources
Original
Copyright link
#
Language
English
用法:
getShareData("parseCommand")(commandRaw);
key: 命令字符串
(e.g.:
/give "that player" stone 1 0 {"can_place_on": {"blocks": ["grass", "air"]}}
)
output: JSON物件
(from e.g.:
{"raw":"/give \"that player\" stone 1 0 {\"can_place_on\": {\"blocks\": [\"grass\", \"air\"]}}","method":"give","args":["that player","stone","1","0","{\"can_place_on\": {\"blocks\": [\"grass\", \"air\"]}}"]}
)
[LINE][/LINE]
例:
1. Static
JavaScript:
getShareData("parseCommand")('give "that player" stone 1 0 {"can_place_on": {"blocks": ["grass", "air"]}}');
2. Putting it in an event listener
JavaScript:
setBeforeActListener("onInputCommand", function (eventDataRaw) {
    let eventData = JSON.parse(eventDataRaw);
    eventData.command = getShareData("parseCommand")(eventData.cmd);
});
[LINE][/LINE]
註:
No target selector support yet.
  • Like
Reactions: Mcayear and YYT
Author
Pneu Jai
Downloads
158
Views
1,344
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Pneu Jai

Share this resource

Latest updates

  1. Minor fixes

    -Removed quotes for quoted arguments -Now the function is saved into shared data