Use Forms¶
Form is a special feature that exists in Minecraft: Bedrock Edition, which allows player to read and input data in a user-friendly way. Allay provides a powerful form API that allows plugins to create and handle forms easily.
Create and Send a Form¶
Let's say you want to show a simple form to the player when they join the server. About how to register event listeners, please refer to register an event listener.
And that's it!. Build and install your plugin,
and when players join the server, they will see a form with the content
Welcome to the server!:

Handle Form Response¶
Let's get deeper. You may want to ask a player if they like your server and reply with different content based on the player's options. Here's how you can do it:
Modal form is a form type that only has two buttons.
And when players join the server, they will see a form with the title Do You Like Allay?
and two buttons Yes and No. When the player clicks on the Yes button, they will receive
a message Thank you!, and when they click on the No button, they will receive a message
Sorry to hear that!:

Use Custom Form¶
Custom forms are the most powerful form type, allowing you to collect various types of data from players. They support multiple element types and are perfect for settings pages, registration forms, or any scenario where you need structured input.
Basic Custom Form Example¶
Let's create a simple feedback form that asks players for their name and comments:
Available Custom Form Elements¶
Custom forms support various element types to collect different kinds of data:
Input¶
Text input field for collecting string data:
Dropdown¶
Dropdown menu for selecting one option from a list:
Toggle¶
Boolean switch (on/off):
Slider¶
Numeric slider for selecting a value within a range:
Step Slider¶
Slider that snaps to predefined text values:
Label¶
Read-only text label (doesn't collect data):
Header¶
Section header for organizing form elements:
Divider¶
Visual separator between form sections:
Complete Example: Player Registration Form¶
Here's a comprehensive example using multiple element types:
Handling Custom Form Response¶
Custom form responses are returned as a List<String> in the order elements were added to the form.
You need to parse the values based on the element type:
| Element Type | Response Format | How to Parse |
|---|---|---|
| Input | String | Direct use: responses.get(index) |
| Dropdown | String (index) | Integer.parseInt(responses.get(index)) |
| Toggle | String (boolean) | Boolean.parseBoolean(responses.get(index)) |
| Slider | String (float) | Float.parseFloat(responses.get(index)) |
| Step Slider | String (index) | Integer.parseInt(responses.get(index)) |
| Label | null | Not included in responses |
| Header | null | Not included in responses |
| Divider | null | Not included in responses |
Important: Response Order
Elements like Label, Header, and Divider do NOT produce responses, but they still affect the indices. Always track the order of elements that produce responses (Input, Dropdown, Toggle, Slider, StepSlider).
Tips for Using Custom Form¶
- Use Headers and Dividers: Organize complex forms into sections for better readability
- Provide Placeholders: Use meaningful placeholder text in input fields to guide users
- Set Default Values: Pre-fill forms with sensible defaults when possible
- Validate Input: Always validate and sanitize user input in your
onResponsehandler - Handle Cancellation: Implement
onClose()to handle when players close the form without submitting
Conclusion¶
Let's make a conclusion! Here are all available form types that you can use in minecraft:
| Type | Description |
|---|---|
| Simple | Simple form can use buttons, and server will receive response when the player presses a button. It is very useful if you want to serve player a set of options and let him choose one. |
| Modal | Modal form is a small form that has two buttons. It is suitable for letting player to confirm something. |
| Custom | Custom form is a form that can use a lot of different elements such as dropdown, slider, toggle and has a submit button at the bottom. It can be used when you want player to submit some data. |