-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,051 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,53 @@ | ||
# Bedrock Custom Commands | ||
|
||
> [*Documentation here*](https://github.com/vytdev/custom-commands/blob/master/docs/index.md) | ||
A powerful custom command handler for Minecraft Bedrock Edition. | ||
|
||
Custom commands in Minecraft Bedrock! | ||
## Documentation | ||
|
||
For comprehensive guides and tutorials on how to use Bedrock Custom Commands, | ||
please refer to our [Documentation](https://vytdev.github.io/custom-commands). | ||
|
||
> **Please note:** The documentation is a work in progress, and some sections | ||
may be incomplete or missing. We're actively working to provide comprehensive | ||
guidance for using Bedrock Custom Commands. Your patience is appreciated as we | ||
continue to improve the documentation. | ||
|
||
## Installation | ||
|
||
To get started with Bedrock Custom Commands, follow these steps: | ||
|
||
1. Download the command handler file for your preferred language (TypeScript or | ||
JavaScript). | ||
2. Place the command handler file in your addon. | ||
3. Configure and customize your custom commands. | ||
|
||
For more detailed installation guidelines, please visit our | ||
[docs](https://vytdev.github.io/custom-commands/install). | ||
|
||
## Contributing | ||
|
||
We welcome contributions to Bedrock Custom Commands! If you'd like to contribute, | ||
here's how you can help: | ||
|
||
- Reporting Issues: If you find a bug, have a feature request, or want to discuss | ||
something related to the project, please open an issue on our | ||
[GitHub repository](https://github.com/YourUsername/YourRepository/issues). | ||
- Making Changes: If you'd like to make improvements or add new features: | ||
|
||
1. Fork the repository. | ||
2. Create a new branch for your changes. | ||
3. Make your changes and commit them. | ||
4. Push your changes to your fork. | ||
5. Submit a pull request with a clear description of your changes. | ||
|
||
That's it! We appreciate your contributions and look forward to working together | ||
to improve Bedrock Custom Commands. | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT License](LICENSE). | ||
|
||
## Acknowledgments | ||
|
||
Special thanks to the open-source community for their valuable contributions and | ||
support. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Command (`Command`) | ||
|
||
The `Command` class represents a custom command that can be executed within the | ||
Minecraft server. This class provides essential properties and methods to define | ||
and manage custom commands, allowing you to create unique gameplay experiences. | ||
Below, you'll find detailed information about the `Command` class, including its | ||
constructor, instance properties, and methods. | ||
|
||
If you're ready to explore the capabilities of the `Command` class and start | ||
crafting custom commands for your Minecraft server, dive into the documentation | ||
below. | ||
|
||
**Constructor:** | ||
|
||
`Command(info: ` [`CommandBuilder`](./CommandBuilder.md)`, fn: ` [`CommandCallback`](./CommandCallback.md)`)` | ||
|
||
An instance of the `Command` class represents a custom command that can be executed | ||
within the Minecraft server. It encapsulates information about the command and the | ||
callback function to execute when the command is invoked. | ||
|
||
- `info` (type: [`CommandBuilder`](./CommandBuilder.md)): | ||
|
||
Information about the command, including its name, description, and other | ||
properties. | ||
|
||
- `fn` (type: [`CommandCallback`](./CommandCallback.md)): | ||
|
||
The callback function to execute when the command is invoked. This function | ||
defines the behavior of the command. | ||
|
||
**Instance Properties:** | ||
|
||
- `info` (type: [`CommandBuilder`](./CommandBuilder.md), readonly) | ||
|
||
Information about the command, including its name, description, and other | ||
properties. | ||
|
||
- `fn` (type: [`CommandCallback`](./CommandCallback.md), readonly) | ||
|
||
The callback function to execute when the command is invoked. This function | ||
defines the behavior of the command. | ||
|
||
- `parseFlags` (type: `boolean`) | ||
|
||
A boolean indicating whether flags should be parsed in this command. If `true`, | ||
the command will process flags and their arguments. | ||
|
||
- `breakableFlags` (type: `boolean`) | ||
|
||
A boolean indicating whether double-dash delimiters should disable subsequent | ||
options in a command. When set to `true`, using `--` will indicate the end of | ||
flags. | ||
|
||
- `javaFlags` (type: `boolean`) | ||
|
||
A boolean indicating whether Java-like parsing for long flags (e.g., -longFlagName) | ||
should be used. When set to `true`, long flags can be parsed with a single dash. | ||
|
||
- `equalsInShortFlags` (type: `boolean`) | ||
|
||
A boolean indicating whether equals signs should be used to parse arguments in | ||
short flags (e.g., `-abcd=argOfFlagD`). When set to `true`, equals signs are | ||
treated as argument separators in short flags. | ||
|
||
**Instance Methods:** | ||
|
||
- `parse(cmd: string, prefixLength?: number)` | ||
|
||
Parses the given string with this command. | ||
|
||
- `cmd` (type: `string`): | ||
|
||
The command string to parse. | ||
|
||
- `prefixLength` (type: `number`, optional): | ||
|
||
The starting position for parsing within the string. | ||
|
||
**Returns:** [`ParsedArgs`](./ParsedArgs.md) | ||
|
||
- `call(cmd: string)` | ||
|
||
Invokes the command with the given arguments. | ||
|
||
- `cmd` (type: `string`): | ||
|
||
The arguments to pass to the command. | ||
|
||
**Returns:** `any` | ||
|
||
This documentation provides a comprehensive overview of the `Command` class, its | ||
properties, and methods. With this knowledge, you can create and manage custom | ||
commands to enhance your Minecraft server's gameplay. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Command Argument Builder (`CommandArgument`) | ||
|
||
The `CommandArgument` class is a fundamental component for defining and managing | ||
arguments in custom commands within the Minecraft server. It offers extensive | ||
customization options, allowing you to tailor arguments precisely to your needs. | ||
|
||
**Constructor:** | ||
|
||
`CommandArgument(name: string, type: string | ` [`CommandTypeParser`](./CommandTypeParser.md), id?: string)` | ||
|
||
Creates a new instance of the `CommandArgument` class, representing an argument | ||
for a custom command. | ||
|
||
- `name` (Type: `string`): | ||
|
||
The name of the argument, which will be displayed in help messages. | ||
|
||
- `type` (Type: `string | ` [`CommandTypeParser`](./CommandTypeParser.md)): | ||
|
||
The type of the argument, which can be either a string representing a | ||
predefined type or a custom parser function. | ||
|
||
- `id` (Type: `string`, optional): | ||
|
||
An optional identifier used to specify where the parsed argument value is | ||
placed. If not provided, it defaults to the `name` argument. | ||
|
||
**Static Methods:** | ||
|
||
- `from(obj: ` [`CommandArgumentType`](./CommandArgumentType.md)`): ` [`CommandArgument`](./CommandArgument.md) | ||
|
||
Creates a new `CommandArgument` instance from an object definition. | ||
|
||
- `obj` (Type: [`CommandArgumentType`]( /CommandArgumentType.md)): | ||
|
||
The `CommandArgumentType` object to process. | ||
|
||
**Returns:** [`CommandArgument`](#) | ||
|
||
**Instance Properties:** | ||
|
||
- `name` (Type: `string`): | ||
|
||
The name of the argument, displayed in help messages. | ||
|
||
- `type` (Type: `string | ` [`CommandTypeParser`](./CommandTypeParser.md)): | ||
|
||
The type of the argument, either a string representing a predefined type or a | ||
custom parser function. | ||
|
||
- `dest` (Type: `string`): | ||
|
||
The destination where the parsed argument value is placed. | ||
|
||
- `help` (Type: `string`): | ||
|
||
The help message explaining the argument's purpose. | ||
|
||
- `required` (Type: `boolean`) | ||
|
||
Indicates whether this argument is required. `true` by default. | ||
|
||
- `default` (Type: `any`) | ||
|
||
The default value for the argument. | ||
|
||
- **Custom Attributes** (Type: `any`) | ||
|
||
Additional custom attributes that can be associated with the argument. | ||
|
||
**Instance Methods:** | ||
|
||
- `setHelp(msg: string): this` | ||
|
||
Sets the help message for this argument. | ||
|
||
- `msg` (Type: `string`): | ||
|
||
The message to set. | ||
|
||
**Returns**: `this` | ||
|
||
- `setRequired(val: boolean): this` | ||
|
||
Sets whether this argument is required. | ||
|
||
- `val` (Type: `boolean`): | ||
|
||
The value to set. | ||
|
||
**Returns:** `this` | ||
|
||
- `setDefault(val: any): this` | ||
|
||
Sets a default value for this argument. | ||
|
||
- `val` (Type: `any`) | ||
|
||
The default value to set, used when the argument is not provided. | ||
|
||
**Returns:** `this` | ||
|
||
- `setAttr(key: string, val: any): this` | ||
|
||
Allows setting custom attributes for this argument. | ||
|
||
- `key` (Type: `string`) | ||
|
||
The name of the attribute to set. | ||
|
||
- `val` (Type: `any`) | ||
|
||
The value to set for the specified key. | ||
|
||
**Returns:** `this` | ||
|
||
This documentation provides a comprehensive overview of the `CommandArgument` | ||
class, its properties, and methods. With this knowledge, you can create and | ||
customize arguments for your custom Minecraft commands, enhancing your server's | ||
gameplay. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# CommandArgumentType | ||
|
||
The `CommandArgumentType` interface defines the structure of command arguments. | ||
It helps in organizing and validating input parameters. | ||
|
||
## Properties: | ||
|
||
- `dest`: Defines where the parsed argument value should be placed. | ||
- `type`: Specifies the expected type of the argument. | ||
- `name` (optional): Displayed name for the argument in help messages. | ||
- `help` (optional): Provides helpful information about the argument. | ||
- `required` (optional): Indicates whether the argument is mandatory. | ||
- `default` (optional): Specifies a default value for the argument. | ||
- **Custom Attributes**: Custom attributes you can pass to the argument parser. |
Oops, something went wrong.