Skip to content

Commit

Permalink
more scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
Citymonstret committed Nov 28, 2023
1 parent e2b7404 commit b1011e0
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions docs/core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Cloud is available through [Maven Central](https://search.maven.org/search?q=clo
## Command

A command is a chain of components. Each unique chain makes up a unique command.
A command can have some properties associated with it, such as a permission, description, etc.

<!-- prettier-ignore -->
!!! example
Expand Down Expand Up @@ -56,4 +57,99 @@ You may also not have two conflicting variable components on the same level, as
which of them gets to parse the input.
You may have _one_ variable component alongside literals, where the literals always get priority.

### Variable Components

A variable component is associated with an output type.
It takes the incoming input and attempts to parse it into the output type using a parser.
See the section on [parsers](#parsers) for more information.

#### Suggestions

Cloud can generate suggestions for values which, depending on the platform, can be displayed
to the player to help them complete the command input.
Most standard parsers generate suggestions, and by default Cloud will ask the parser for suggestions.
You may provide your own suggestions using a suggestion provider.

## Command Manager

### Creating a command manager

#### Execution coordinators

### Building a command

#### Descriptions

#### Permissions

#### Sender types

#### Components

#### Literals

#### Variable

##### Required

##### Optional

### Executing a command

### Customizing the command manager

#### Pre-processing

#### Post-processing

#### Exception handling

## Extra

### Configurations

### Help generation

## Parsers

### Parser Registry

### Standard Parsers

#### String

#### Character

#### Numbers

#### Boolean

#### Enum

### Flags

### Aggregate Parsers

Aggregate parsers are a new concept as of Cloud v2, and they supersede the old compound argument concept.
An aggregate parser is a combination of multiple parsers that maps the intermediate results into an output
type using a mapper.

You may either implement the `AggregateCommandParser` interface, or using construct the parser by using a builder
that you create by calling `AggregateCommandParser.builder()`.

<!-- prettier-ignore -->
!!! example
```java
final AggregateCommandParser<CommandSender, Location> locationParser = AggregateCommandParser<CommandSender>builder()
.withComponent("world", worldParser())
.withComponent("x", integerParser())
.withComponent("y", integerParser())
.withComponent("z", integerParser())
.withMapper(Location.class, (commandContext, aggregateCommandContext) -> {
final World world = aggregateCommandContext.get("world");
final int x = aggregateCommandContext.get("x");
final int y = aggregateCommandContext.get("y");
final int z = aggregateCommandContext.get("z");
return CompletableFuture.completedFuture(new Location(world, x, y, z));
}).build();
```

0 comments on commit b1011e0

Please sign in to comment.