- Compatible API Versions
- 1.0.9
- Sourcecode
- https://github.com/qPexLegendary/FormAPI
- Contributors
- qPexLegendary
# FormAPI | NukkitX
Simple API for creating forms (MCBE Nukkit)
Usage example:
SimpleForm:
CustomForm:
ModalForm:
Simple API for creating forms (MCBE Nukkit)
Usage example:
SimpleForm:
Code:
SimpleForm form = new SimpleForm("Test form")
.setContent("Some kind of test text should be written here.")
.addButton("Button")
.addButton("Button with a picture", ImageType.PATH, "textures/items/diamond");
form.send(player, (targetPlayer, targetForm, data) -> {
if(data == -1) return; //If the form is closed forcibly, then data will have a value of -1
targetPlayer.sendMessage(data.toString());
});
CustomForm:
Code:
CustomForm form = new CustomForm()
.addLabel("Here some random text should be written, but it is written.")
.addDropDown("Drop-down list", Arrays.asList("Var 1", "Var 2", "Var 3"))
.addInput("Text field")
.addSlider("Slider", 1, 100)
.addStepSlider("Step slider", Arrays.asList("Var 1", "Var 2", "Var 3"))
.addToggle("Toggle", false);
form.send(player, (targetPlayer, targetForm, data) -> {
if(data == null) return; //If the form is closed forcibly, then data will have a value of null
targetPlayer.sendMessage(data.toString());
});
ModalForm:
Code:
ModalForm form = new ModalForm("HEADER", "TEXT", "BUTTON 1", "BUTTON 2");
form.send(player, (targetPlayer, targetForm, data) -> {
if(data == -1) return; //If the form is closed forcibly, then data will have a value of -1
targetPlayer.sendMessage(data.toString());
});