File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ## Pica
2+
3+ A lightweight Dialog API for [ Minestom] ( https://minestom.net/ ) , built around Minecraft's native dialog system.
4+
5+ ### Usage
6+
7+ Dialogs are built via ` DialogType ` and opened directly on a ` Player ` . The template is associated via a key from Adventure.
8+
9+ ``` java
10+ DialogTemplate dialog = DialogType . confirm(MY_KEY )
11+ .meta(meta - > {
12+ meta. title(Component . text(" Confirm deletion" ));
13+ meta. closeWithEscape(false );
14+ meta. afterAction(DialogAfterAction . CLOSE );
15+ meta. messageBody(body - > body. width(400 ). contents(Component . text(" This action cannot be undone!" , NamedTextColor . RED )));
16+ })
17+ .yesButton(button - > button. label(Component . text(" Yes" )). action(myAction))
18+ .noButton(button - > button. label(Component . text(" No" )))
19+ .build();
20+
21+ dialog. open(player);
22+ ```
23+
24+ Dialogs can optionally be tracked via a ` DialogRegistry ` :
25+
26+ ``` java
27+ DialogRegistry registry = DialogRegistry . of();
28+ registry. add(dialog);
29+ registry. get(MY_KEY ). open(player);
30+ ```
31+
32+ ### Limitations
33+
34+ Currently only confirmation dialogs (` DialogType.confirm ` ) are supported. Support for further Minecraft dialog types is planned.
You can’t perform that action at this time.
0 commit comments