Skip to content

OneLiteFeatherNET/pica

Pica

A lightweight Dialog API for Minestom, built around Minecraft's native dialog system.

Usage

Dialogs are built via DialogType and opened directly on a Player. The template is associated via a key from Adventure.

DialogTemplate dialog = DialogType.confirm(MY_KEY)
    .meta(meta -> {
        meta.title(Component.text("Confirm deletion"));
        meta.closeWithEscape(false);
        meta.afterAction(DialogAfterAction.CLOSE);
        meta.messageBody(body -> body.width(400).contents(Component.text("This action cannot be undone!", NamedTextColor.RED)));
    })
    .yesButton(button -> button.label(Component.text("Yes")).action(myAction))
    .noButton(button -> button.label(Component.text("No")))
    .build();

dialog.open(player);

Dialogs can optionally be tracked via a DialogRegistry:

DialogRegistry registry = DialogRegistry.of();
registry.add(dialog);
registry.get(MY_KEY).open(player);

Limitations

Currently only confirmation dialogs (DialogType.confirm) are supported. Support for further Minecraft dialog types is planned.

About

No description or website provided.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages