Skip to content

Commit 4ea9f28

Browse files
committed
big changes in the docs
1 parent a0afa23 commit 4ea9f28

33 files changed

+1051
-134
lines changed

README.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
# Bedrock Custom Commands
22

3-
> [*Documentation here*](https://github.com/vytdev/custom-commands/blob/master/docs/index.md)
3+
A powerful custom command handler for Minecraft Bedrock Edition.
44

5-
Custom commands in Minecraft Bedrock!
5+
## Documentation
6+
7+
For comprehensive guides and tutorials on how to use Bedrock Custom Commands,
8+
please refer to our [Documentation](https://vytdev.github.io/custom-commands).
9+
10+
> **Please note:** The documentation is a work in progress, and some sections
11+
may be incomplete or missing. We're actively working to provide comprehensive
12+
guidance for using Bedrock Custom Commands. Your patience is appreciated as we
13+
continue to improve the documentation.
14+
15+
## Installation
16+
17+
To get started with Bedrock Custom Commands, follow these steps:
18+
19+
1. Download the command handler file for your preferred language (TypeScript or
20+
JavaScript).
21+
2. Place the command handler file in your addon.
22+
3. Configure and customize your custom commands.
23+
24+
For more detailed installation guidelines, please visit our
25+
[docs](https://vytdev.github.io/custom-commands/install).
26+
27+
## Contributing
28+
29+
We welcome contributions to Bedrock Custom Commands! If you'd like to contribute,
30+
here's how you can help:
31+
32+
- Reporting Issues: If you find a bug, have a feature request, or want to discuss
33+
something related to the project, please open an issue on our
34+
[GitHub repository](https://github.com/YourUsername/YourRepository/issues).
35+
- Making Changes: If you'd like to make improvements or add new features:
36+
37+
1. Fork the repository.
38+
2. Create a new branch for your changes.
39+
3. Make your changes and commit them.
40+
4. Push your changes to your fork.
41+
5. Submit a pull request with a clear description of your changes.
42+
43+
That's it! We appreciate your contributions and look forward to working together
44+
to improve Bedrock Custom Commands.
45+
46+
## License
47+
48+
This project is licensed under the [MIT License](LICENSE).
49+
50+
## Acknowledgments
51+
52+
Special thanks to the open-source community for their valuable contributions and
53+
support.

docs/CommandArgument.md

Lines changed: 0 additions & 104 deletions
This file was deleted.

docs/api/Command.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Command (`Command`)
2+
3+
The `Command` class represents a custom command that can be executed within the
4+
Minecraft server. This class provides essential properties and methods to define
5+
and manage custom commands, allowing you to create unique gameplay experiences.
6+
Below, you'll find detailed information about the `Command` class, including its
7+
constructor, instance properties, and methods.
8+
9+
If you're ready to explore the capabilities of the `Command` class and start
10+
crafting custom commands for your Minecraft server, dive into the documentation
11+
below.
12+
13+
**Constructor:**
14+
15+
`Command(info: ` [`CommandBuilder`](./CommandBuilder.md)`, fn: ` [`CommandCallback`](./CommandCallback.md)`)`
16+
17+
An instance of the `Command` class represents a custom command that can be executed
18+
within the Minecraft server. It encapsulates information about the command and the
19+
callback function to execute when the command is invoked.
20+
21+
- `info` (type: [`CommandBuilder`](./CommandBuilder.md)):
22+
23+
Information about the command, including its name, description, and other
24+
properties.
25+
26+
- `fn` (type: [`CommandCallback`](./CommandCallback.md)):
27+
28+
The callback function to execute when the command is invoked. This function
29+
defines the behavior of the command.
30+
31+
**Instance Properties:**
32+
33+
- `info` (type: [`CommandBuilder`](./CommandBuilder.md), readonly)
34+
35+
Information about the command, including its name, description, and other
36+
properties.
37+
38+
- `fn` (type: [`CommandCallback`](./CommandCallback.md), readonly)
39+
40+
The callback function to execute when the command is invoked. This function
41+
defines the behavior of the command.
42+
43+
- `parseFlags` (type: `boolean`)
44+
45+
A boolean indicating whether flags should be parsed in this command. If `true`,
46+
the command will process flags and their arguments.
47+
48+
- `breakableFlags` (type: `boolean`)
49+
50+
A boolean indicating whether double-dash delimiters should disable subsequent
51+
options in a command. When set to `true`, using `--` will indicate the end of
52+
flags.
53+
54+
- `javaFlags` (type: `boolean`)
55+
56+
A boolean indicating whether Java-like parsing for long flags (e.g., -longFlagName)
57+
should be used. When set to `true`, long flags can be parsed with a single dash.
58+
59+
- `equalsInShortFlags` (type: `boolean`)
60+
61+
A boolean indicating whether equals signs should be used to parse arguments in
62+
short flags (e.g., `-abcd=argOfFlagD`). When set to `true`, equals signs are
63+
treated as argument separators in short flags.
64+
65+
**Instance Methods:**
66+
67+
- `parse(cmd: string, prefixLength?: number)`
68+
69+
Parses the given string with this command.
70+
71+
- `cmd` (type: `string`):
72+
73+
The command string to parse.
74+
75+
- `prefixLength` (type: `number`, optional):
76+
77+
The starting position for parsing within the string.
78+
79+
**Returns:** [`ParsedArgs`](./ParsedArgs.md)
80+
81+
- `call(cmd: string)`
82+
83+
Invokes the command with the given arguments.
84+
85+
- `cmd` (type: `string`):
86+
87+
The arguments to pass to the command.
88+
89+
**Returns:** `any`
90+
91+
This documentation provides a comprehensive overview of the `Command` class, its
92+
properties, and methods. With this knowledge, you can create and manage custom
93+
commands to enhance your Minecraft server's gameplay.

docs/api/CommandArgument.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Command Argument Builder (`CommandArgument`)
2+
3+
The `CommandArgument` class is a fundamental component for defining and managing
4+
arguments in custom commands within the Minecraft server. It offers extensive
5+
customization options, allowing you to tailor arguments precisely to your needs.
6+
7+
**Constructor:**
8+
9+
`CommandArgument(name: string, type: string | ` [`CommandTypeParser`](./CommandTypeParser.md), id?: string)`
10+
11+
Creates a new instance of the `CommandArgument` class, representing an argument
12+
for a custom command.
13+
14+
- `name` (Type: `string`):
15+
16+
The name of the argument, which will be displayed in help messages.
17+
18+
- `type` (Type: `string | ` [`CommandTypeParser`](./CommandTypeParser.md)):
19+
20+
The type of the argument, which can be either a string representing a
21+
predefined type or a custom parser function.
22+
23+
- `id` (Type: `string`, optional):
24+
25+
An optional identifier used to specify where the parsed argument value is
26+
placed. If not provided, it defaults to the `name` argument.
27+
28+
**Static Methods:**
29+
30+
- `from(obj: ` [`CommandArgumentType`](./CommandArgumentType.md)`): ` [`CommandArgument`](./CommandArgument.md)
31+
32+
Creates a new `CommandArgument` instance from an object definition.
33+
34+
- `obj` (Type: [`CommandArgumentType`]( /CommandArgumentType.md)):
35+
36+
The `CommandArgumentType` object to process.
37+
38+
**Returns:** [`CommandArgument`](#)
39+
40+
**Instance Properties:**
41+
42+
- `name` (Type: `string`):
43+
44+
The name of the argument, displayed in help messages.
45+
46+
- `type` (Type: `string | ` [`CommandTypeParser`](./CommandTypeParser.md)):
47+
48+
The type of the argument, either a string representing a predefined type or a
49+
custom parser function.
50+
51+
- `dest` (Type: `string`):
52+
53+
The destination where the parsed argument value is placed.
54+
55+
- `help` (Type: `string`):
56+
57+
The help message explaining the argument's purpose.
58+
59+
- `required` (Type: `boolean`)
60+
61+
Indicates whether this argument is required. `true` by default.
62+
63+
- `default` (Type: `any`)
64+
65+
The default value for the argument.
66+
67+
- **Custom Attributes** (Type: `any`)
68+
69+
Additional custom attributes that can be associated with the argument.
70+
71+
**Instance Methods:**
72+
73+
- `setHelp(msg: string): this`
74+
75+
Sets the help message for this argument.
76+
77+
- `msg` (Type: `string`):
78+
79+
The message to set.
80+
81+
**Returns**: `this`
82+
83+
- `setRequired(val: boolean): this`
84+
85+
Sets whether this argument is required.
86+
87+
- `val` (Type: `boolean`):
88+
89+
The value to set.
90+
91+
**Returns:** `this`
92+
93+
- `setDefault(val: any): this`
94+
95+
Sets a default value for this argument.
96+
97+
- `val` (Type: `any`)
98+
99+
The default value to set, used when the argument is not provided.
100+
101+
**Returns:** `this`
102+
103+
- `setAttr(key: string, val: any): this`
104+
105+
Allows setting custom attributes for this argument.
106+
107+
- `key` (Type: `string`)
108+
109+
The name of the attribute to set.
110+
111+
- `val` (Type: `any`)
112+
113+
The value to set for the specified key.
114+
115+
**Returns:** `this`
116+
117+
This documentation provides a comprehensive overview of the `CommandArgument`
118+
class, its properties, and methods. With this knowledge, you can create and
119+
customize arguments for your custom Minecraft commands, enhancing your server's
120+
gameplay.

docs/api/CommandArgumentType.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# CommandArgumentType
2+
3+
The `CommandArgumentType` interface defines the structure of command arguments.
4+
It helps in organizing and validating input parameters.
5+
6+
## Properties:
7+
8+
- `dest`: Defines where the parsed argument value should be placed.
9+
- `type`: Specifies the expected type of the argument.
10+
- `name` (optional): Displayed name for the argument in help messages.
11+
- `help` (optional): Provides helpful information about the argument.
12+
- `required` (optional): Indicates whether the argument is mandatory.
13+
- `default` (optional): Specifies a default value for the argument.
14+
- **Custom Attributes**: Custom attributes you can pass to the argument parser.

0 commit comments

Comments
 (0)