NukkitFormAPI 2018-04-24

Form API for Nukkit - Incorporate forms into your plugin very easily.

  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
We welcome you on our site. This site is devoted to the Nukkit project and all that is connected with him. Here you can communicate, download plugins, also many other things get acquainted! Register the account right now :3
  1. itsu020402
    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:

Recent Reviews

  1. Buddelbubi
    Version: 2018-04-24
    Link is broken