Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial docs for ComponentParser #33

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
15 changes: 15 additions & 0 deletions docs/minecraft/minecraft-extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [MinecraftExceptionHandler](#minecraft-exception-handler)
- [RichDescription](#rich-description)
- [TextColorParser](#text-color-parser)
- [ComponentParser](#component-parser)

</div>

Expand Down Expand Up @@ -148,3 +149,17 @@ It parses `NamedTextColor`, legacy color codes using `&` as well as hex codes.
```java
ParserDescriptor<?, TextColor> parser = TextColorParser.textColorParser();
```

## Component Parser

`ComponentParser` is a [parser](../core/index.md#parsers) which parses Adventure `Component`s via
a specified "decoder" function.

```java
// This creates a parser that uses MiniMessage for decoding the argument, and uses
// greedy string parsing.
ParserDescriptor<?, Component> parser = ComponentParser.componentParser(
MiniMessage.miniMessage(),
StringParser.StringMode.GREEDY_FLAG_YIELDING
);
```
Loading