|
| 1 | ++++ |
| 2 | +title = "Adventure Component" |
| 3 | +weight = 3 |
| 4 | ++++ |
| 5 | + |
| 6 | +For some components that display Text (label, title, etc.), there are variants that can be used for advanced purposes. |
| 7 | + |
| 8 | +This page will provide the possible ways to use the Adventure Component. |
| 9 | + |
| 10 | +## MiniMessage |
| 11 | + |
| 12 | +> Support: PaperMC |
| 13 | +
|
| 14 | +You can use MiniMessage to format text in your components by wrapping the key option in either the prefix `mini-` or the postfix `$`. For example: |
| 15 | +- `title` will be `mini-title` or `title$` |
| 16 | +- `label` will be `mini-label` or `label$` |
| 17 | + |
| 18 | +```yaml |
| 19 | +name: |
| 20 | + type: text |
| 21 | + text$: "Hello <rainbow>world</rainbow>, isn't <blue><u><click:open_url:'https://docs.advntr.dev/minimessage'>MiniMessage</click></u></blue> fun?" |
| 22 | +``` |
| 23 | +
|
| 24 | +### MiniPlaceholders |
| 25 | +
|
| 26 | +You can use the placeholders provided by MiniPlaceholders to display dynamic information in your components. |
| 27 | +
|
| 28 | +```yaml |
| 29 | +ping: |
| 30 | + type: text |
| 31 | + text$: "<player_name>: <player_ping>" |
| 32 | +``` |
| 33 | +
|
| 34 | +## JSON |
| 35 | +
|
| 36 | +> Support: PaperMC, PacketEvents |
| 37 | +
|
| 38 | +You can use JSON to format text in your components by wrapping the key option in either the prefix `json-`. For example: |
| 39 | +- `title` will be `json-title` |
| 40 | +- `label` will be `json-label` |
| 41 | + |
| 42 | +```yaml |
| 43 | +json: |
| 44 | + type: text |
| 45 | + json-text: '["",{"text":"Welcome "},{"text":"to","italic":true},{"text":" BetterDialogs","bold":true,"color":"yellow"}]' |
| 46 | +``` |
| 47 | + |
| 48 | +## Example |
| 49 | + |
| 50 | +```yaml |
| 51 | +menu-settings: |
| 52 | + menu-type: notice-dialog |
| 53 | + title: "Example Dialog" |
| 54 | + command: exampledialog |
| 55 | +
|
| 56 | +name: |
| 57 | + type: text |
| 58 | + text$: "Hello <rainbow>world</rainbow>, isn't <blue><u><click:open_url:'https://docs.advntr.dev/minimessage'>MiniMessage</click></u></blue> fun?" |
| 59 | +
|
| 60 | +ping: |
| 61 | + type: text |
| 62 | + text$: "<player_name>: <player_ping>" |
| 63 | +
|
| 64 | +json: |
| 65 | + type: text |
| 66 | + json-text: '["",{"text":"Welcome "},{"text":"to","italic":true},{"text":" BetterDialogs","bold":true,"color":"yellow"}]' |
| 67 | +``` |
| 68 | + |
| 69 | + |
0 commit comments