You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apis/GameAPI/Command.md
+23-27Lines changed: 23 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,9 +43,9 @@ mc.runcmd("say Hello!")
43
43
| res.output | The output result after BDS executes the command. |`String`|
44
44
45
45
!!! note
46
-
The implementation of runcmdEx is very different from ordinary runcmd. The Enhanced version has a **hidden execution**
47
-
mechanism, and the execution result will not be output to the console. Therefore, if necessary, you must manually use
48
-
the log function to output the result.
46
+
The implementation of runcmdEx is very different from ordinary runcmd. The Enhanced version has a **hidden execution**
47
+
mechanism, and the execution result will not be output to the console. Therefore, if necessary, you must manually use
48
+
the log function to output the result.
49
49
50
50
[JavaScript]
51
51
@@ -60,8 +60,8 @@ An interface for registering custom commands is provided here. By docking with t
60
60
commands you register can be used by players, consoles, command blocks, NPCs and other objects that can execute commands
61
61
in games. In addon, you can also use the commands registered here.
62
62
!!! warning
63
-
Except for variable parameters (String, RawText, Message, etc.), the commands cannot contain non-English lowercase
64
-
letters!
63
+
Except for variable parameters (String, RawText, Message, etc.), the commands cannot contain non-English lowercase
64
+
letters!
65
65
66
66
### Register a Top-Level Command
67
67
@@ -92,8 +92,7 @@ letters!
92
92
- Return value type: `Command`
93
93
94
94
!!! tip
95
-
Top-level commands, i.e. something like `list``gamerule`, the first input after the `/` character.
96
-
95
+
Top-level commands, i.e. something like `list``gamerule`, the first input after the `/` character.
97
96
After registering the top-level command, this function returns a command object. Next, the function expansion of this command needs to be carried out in this command object.
98
97
99
98
### Command Object - Function
@@ -201,9 +200,9 @@ The command object has the following member functions.
201
200
- Return value type: `Boolean`
202
201
203
202
!!! tip
204
-
Command overloading is the method used by BDS to distinguish different command forms, and each different command form
205
-
corresponds to a command overloading.
206
-
As you can see, the parameter names provided in the command overload form a new command form.
203
+
Command overloading is the method used by BDS to distinguish different command forms, and each different command form
204
+
corresponds to a command overloading.
205
+
As you can see, the parameter names provided in the command overload form a new command form.
207
206
208
207
#### Set Command Callback
209
208
@@ -216,7 +215,7 @@ As you can see, the parameter names provided in the command overload form a new
216
215
- Return value type: `Boolean`
217
216
218
217
!!! tip
219
-
The parameters of the command callback function are relatively complex, which will be explained in detail below.
218
+
The parameters of the command callback function are relatively complex, which will be explained in detail below.
220
219
221
220
#### Installation Instructions
222
221
@@ -359,10 +358,9 @@ The fake command API here is reserved for **downward compatibility**. It is reco
359
358
written in the above document.
360
359
361
360
!!! warning
362
-
Although it looks relatively simple, fake commands have some important disadvantages, including that they can only be
363
-
executed by the player or console, other objects (such as command blocks, NPCs, etc.) cannot be executed, all parameter
364
-
data needs to be parsed by themselves, etc.
365
-
361
+
Although it looks relatively simple, fake commands have some important disadvantages, including that they can only be
362
+
executed by the player or console, other objects (such as command blocks, NPCs, etc.) cannot be executed, all parameter
363
+
data needs to be parsed by themselves, etc.
366
364
Please try to use the real command API.
367
365
368
366
### Register a New Player Command (Fake Command)
@@ -433,18 +431,16 @@ mc.regConsoleCmd("backup", "Start the backup", function (args) {
433
431
```
434
432
435
433
!!! tip "Instructions on Fake Order Registration"
436
-
After setting the callback function, the callback function will be called when the fake command you registered is
437
-
executed.
438
-
LLSE will automatically split the command arguments into arrays for you before calling them.
0 commit comments