Resource icon

NukkitFormAPI 2018-04-24

No permission to download
Form API for Nukkit. This API supports processing of form responses, so you do not have to make EventListener which processes ModalFormResponsePacket. It will provide you the new type of form processing.

Depend with Maven
This API is developed by Maven project. So your plugin have to depend with this API through Maven.

Add EventListener
You have to register NukkitFormEventListener class to Nukkit Event processing system to handle events.
First, write these codes into onEnable() method.

import itsu.mcbe.form.event.NukkitFormEventListener;

//Write into onEnable() method
this.getServer().getPluginManager().registerEvents(new NukkitFormEventListener(), this);

SimpleForm(A simple form which has some buttons and textarea)
Button button1 = new Button() {
public void onClick(Player player) {
//This method is called when "button1" button clicked.​
.setImage("url", "IMAGE_URL");​

SimpleForm form = new SimpleForm() {
public void onEnter(Player player, int index) {
//This method is called when player clicked button.
//"index" variable expresses an index number of the button.​
.setId(123) //Form Id
.setTitle("TITLE") //Title
.setContent("CONTENT_TEXT") //Texts
.addButton(button1); //Add button
//You can use: addButtons(List<Button>)​

You can add listener to button through override "onClick()" method in Button class.
Or you can add listener to SimpleForm through override "onEnter()" method in SimpleForm class.

ModalForm(A form which has two buttons and one textarea)
ModalForm form = new ModalForm() {
public void onButton1Click(Player player) {
//This method is called when upside button clicked.​

public void onButton2Click(Player player) {
//This method is called when downside button clicked.​
.setId(123) //Form id
.setTitle("TITLE") //Title
.setContent("CONTENT_TEXT"); //Text​

You can add a listener through override "onButton1Click()" and "onButton2()" methods in ModalForm class.
(Button1 = upside button, Button2 = downside button)

CustomForm(A form which has various elements)
CustomForm form = new CustomForm() {
public void onEnter(Player player, List<Object> response) {
//This method is called when enter the form.​
.setId(123) //ID
.setTitle("TITLE") //Title
.addFormElement(new Label("LABEL_TEXT"))
//This API has more types of form elements.
.addFormElement(new Input()
//You can use: addFormElements(List<FormElements>)​

You can add a listener through override "onEnter(List)" method in CustomForm class.

Send Form
NukkitFormAPI.sendFormToPlayer(Player, Form);
You must use this method when you send form you made from this API.

I recommend you to see GitHub:
First release
Last update
1.00 star(s) 1 ratings

More resources from itsu020402

Latest reviews

Link is broken