-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tweaks & start of minecraft-extras docs
- Loading branch information
1 parent
b8b184b
commit f38d688
Showing
10 changed files
with
150 additions
and
16 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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,5 @@ | ||
# cloud-brigadier | ||
|
||
[Brigadier](https://github.com/mojang/brigadier) is Mojang's command system. Cloud integrates with Brigadier on platforms | ||
where this is supported. Unless you want to create a platform integration it is unlikely that you will want to depend | ||
on `cloud-brigadier` directly. Instead, you are able to interact with Brigadier through the platform integration. |
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 +1,18 @@ | ||
# cloud-minecraft | ||
|
||
## Modules | ||
|
||
<div class="grid cards" markdown> | ||
|
||
- [Brigadier](./brigadier.md) | ||
- [Minecraft Extras](./minecraft-extras.md) | ||
- [Bukkit](./bukkit.md) | ||
- [Paper](./paper.md) | ||
- [Velocity](./velocity.md) | ||
- [BungeeCord](./bungee.md) | ||
- [NeoForge](./neoforge.md) | ||
- [Fabric](./fabric.md) | ||
- [Sponge](./sponge.md) | ||
- [Cloudburst](./cloudburst.md) | ||
|
||
</div> |
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,115 @@ | ||
# cloud-minecraft-extras | ||
|
||
`cloud-minecraft-extras` contains some optional utilities for the Minecraft integrations. | ||
|
||
<div class="grid cards" markdown> | ||
|
||
- [MinecraftHelp](#minecraft-help) | ||
- [MinecraftExceptionHandler](#minecraft-exception-handler) | ||
- [RichDescription](#rich-description) | ||
- [TextColorParser](#text-color-parser) | ||
|
||
</div> | ||
|
||
<!-- prettier-ignore --> | ||
!!! note | ||
These utilities depend on [adventure](https://docs.advntr.dev/). You may need to depend on Adventure and shade it | ||
into your project, depending on the platform you're targeting. Many Minecraft platforms, such as Paper, ship with | ||
native implementations of Adventure, in which case you do not need to include it yourself. | ||
|
||
## Minecraft Help | ||
|
||
`MinecraftHelp` is an opinionated implementation of the [help system](../core/index.md#help-generation) using | ||
Adventure components for styling and click handling. | ||
|
||
![Minecraft Help 1](../assets/images/mce_help_1_dark.png#only-dark) | ||
![Minecraft Help 1](../assets/images/mce_help_1_light.png#only-light) | ||
![Minecraft Help 2](../assets/images/mce_help_2_dark.png#only-dark) | ||
![Minecraft Help 2](../assets/images/mce_help_2_light.png#only-light) | ||
|
||
All interactions with the Minecraft help system will take place through a `MinecraftHelp` instance. | ||
|
||
You may create an instance with the default styling: | ||
|
||
<!-- prettier-ignore --> | ||
=== "Native Audience" | ||
|
||
```java | ||
// Assuming YourSenderType extends Audience | ||
MinecraftHelp<YourSenderType> help = MinecraftHelp.createNative( | ||
"helpcommand", | ||
commandManager | ||
); | ||
``` | ||
|
||
=== "Other" | ||
|
||
```java | ||
MinecraftHelp<YourSenderType> help = MinecraftHelp.create( | ||
"helpcommand", | ||
commandManager, | ||
audienceMapper // YourSenderType -> Audience | ||
); | ||
``` | ||
|
||
or you may override the defaults by using a builder: | ||
|
||
<!-- prettier-ignore --> | ||
=== "Native Audience" | ||
|
||
```java | ||
MinecraftHelp<YourSenderType> help = MinecraftHelp.<YourSenderType>builder() | ||
.commandManager(commandManager) | ||
.audienceProvider(AudienceProvider.nativeProvider()) | ||
.commandPrefix("/helpcommand") | ||
/* other settings... */ | ||
.build(); | ||
``` | ||
|
||
=== "Other" | ||
|
||
```java | ||
MinecraftHelp<YourSenderType> help = MinecraftHelp.<YourSenderType>builder() | ||
.commandManager(commandManager) | ||
.audienceProvider(yourAudienceProvider) | ||
.commandPrefix("/helpcommand") | ||
/* other settings... */ | ||
.build(); | ||
``` | ||
|
||
You then want to invoke `MinecraftHelp.queryCommands(query, recipient)` in order to query the commands | ||
and display the results to the recipient. | ||
|
||
```java title="Example Help Command" | ||
commandManager.command( | ||
commandManager.commandBuilder("helpcommand") | ||
.optional("query", greedyStringParser(), DefaultValue.constant("")) | ||
.handler(context -> { | ||
help.queryCommands(context.get("query"), context.sender()); | ||
}) | ||
); | ||
``` | ||
|
||
You may choose to add suggestions to the query argument as well: | ||
|
||
```java title="Query Suggestions" | ||
.optional( | ||
"query", | ||
greedyStringParser(), | ||
DefaultValue.constant(""), | ||
SuggestionProvider.blocking((ctx, in) -> commandManager.createHelpHandler() | ||
.queryRootIndex(ctx.sender()) | ||
.entries() | ||
.stream() | ||
.map(CommandEntry::syntax) | ||
.map(Suggestion::simple) | ||
.collect(Collectors.toList()) | ||
) | ||
) | ||
``` | ||
|
||
## Minecraft Exception Handler | ||
|
||
## Rich Description | ||
|
||
## Text Color Parser |