Skip to content

Commit 5a09740

Browse files
committed
Small changes
1 parent ffbc2ac commit 5a09740

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

docs/paper/dev/api/command-api/basics/custom-arguments.mdx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ default <S> T convert(final N nativeType, final S source) throws CommandSyntaxEx
192192
These methods work similarly to the `parse` methods, but they instead provide you with the parsed, native type instead of a `StringReader`.
193193
This reduced the need to manually do string reader operations and instead directly uses the native type's parsing rules.
194194

195+
## Error handling during the suggestions phase
196+
In case you are looking for the ability to make the client show currently typed input as red to display invalid input, it should be noted that this is **not possible** with
197+
custom arguments. The client is only able to validate arguments it knows about and there is no way to throw a `CommandSyntaxException` during the suggestions phase. The only way to
198+
achieve that is by using **literals**, but those cannot be modified dynamically during server runtime.
199+
200+
<div style={{display: 'inline-block', width: '100%'}}>
201+
<img src={IceCreamInvalidPng} style={{float: 'left', width: '100%'}}/>
202+
</div>
203+
195204
## Example: Ice-cream argument
196205
A practical example on how you can use a custom argument to your advantage could be a classical enum-type argument. In our case, we use this
197206
`IceCreamFlavor` enum:
@@ -275,13 +284,3 @@ Commands.literal("icecream")
275284
<div style={{display: 'inline-block', width: '100%'}}>
276285
<img src={IceCreamPng} style={{float: 'left', width: '100%'}}/>
277286
</div>
278-
279-
## Note: Error handling during suggestions phase
280-
In case you are looking for the ability to make the client show currently typed input as red to display invalid input, it should be noted that this is **not possible** with
281-
custom arguments. The client is only able to validate arguments it knows about and there is no way to throw a `CommandSyntaxException` during the suggestions phase. The only way to
282-
achieve that is by using **literals**, but those cannot be modified dynamically during server runtime.
283-
284-
285-
<div style={{display: 'inline-block', width: '100%'}}>
286-
<img src={IceCreamInvalidPng} style={{float: 'left', width: '100%'}}/>
287-
</div>

docs/paper/dev/api/command-api/basics/introduction.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The following sites are worth-while to look through first when learning about Br
3131
- [Command Registration](./registration)
3232
- [Command Requirements](./requirements)
3333
- [Argument Suggestions](./argument-suggestions)
34+
- [Custom Arguments](./custom-arguments)
3435

3536
For a reference of more advanced arguments, you should look here:
3637
- [Minecraft Arguments](../arguments/minecraft)
@@ -39,7 +40,6 @@ For a reference of more advanced arguments, you should look here:
3940

4041
The following pages will be added to the documentation in the future:
4142

42-
- **Custom Arguments**
4343
- **Tutorial: Creating Utility Commands**
4444
- **The Command Dispatcher**
4545
- **Forks and Redirects**
@@ -48,4 +48,4 @@ The following pages will be added to the documentation in the future:
4848
:::
4949

5050
## Additional support
51-
For support regarding the command API, you can always ask in our [Discord Server](https://discord.gg/PaperMC) in the `#paper-dev` channel!
51+
For support regarding the command API, you can always ask in our [Discord Server](https://discord.gg/PaperMC) in the `#paper-dev` channel!

0 commit comments

Comments
 (0)