Skip to content

Commit c34453d

Browse files
feat(project): add readme file (#2)
Co-authored-by: theEvilReaper <theEvilReaper@users.noreply.github.com>
1 parent 8271bb2 commit c34453d

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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.

0 commit comments

Comments
 (0)