- Compatible API Versions
- 1.0.0
- Sourcecode
- https://github.com/MEFRREEX/FormCreator
FormCreator
Tool for easy creation of forms in Json file for Nukkit
Dependencies
FormConstructor
GitHub: https://github.com/ContentForge/FormConstructor/releases/tag/1.1.3
How to use
Example form:
example.json
Registration of the form:
forms.yml
Commands
API
FormManager
Get a folder with forms:
Getting a form by name:
Check the existence of the form:
Load form from file:
Creating a custom action executor
Your executor:
Executor registration:
Getting a executor:
Events
Tool for easy creation of forms in Json file for Nukkit
Dependencies
FormConstructor
GitHub: https://github.com/ContentForge/FormConstructor/releases/tag/1.1.3
How to use
Example form:
example.json
JSON:
{
"command": {
"enable": true,
"name": "example",
"description": "Example command",
"aliases": [
"example1"
],
"permission": "formcreator.example"
},
"title": "Example Form",
"content": [
"Content line"
],
"buttons": [
{
"name": "Button",
"image": "textures/blocks/diamond",
"imageType": "path",
"actions": [
{
"type": "OPEN",
"value": "example"
}
]
},
{
"name": "Button 2",
"actions": [
{
"type": "PLAYER_COMMAND",
"value": "say Test"
}
]
}
],
"openActions": [
{
"type": "CONSOLE_COMMAND",
"value": "say {player} Form opened!"
}
],
"closeActions": [
{
"type": "CONSOLE_COMMAND",
"value": "say {player} Form closed!"
}
]
}
Registration of the form:
forms.yml
YAML:
# Registration of the form
forms:
# form name: "form path in the 'forms' folder"
example: "example.json"
Name | Sub Command | Usage | Description | Permission |
/formcreator | open | /formcreator open <form> <player> | Open player form | formcreator.open |
/formcreator | info | /formcreator info | Plugin info | formcreator.info |
/formcreator | help | /formcreator help | Help |
FormManager
Get a folder with forms:
Java:
File folder = FormManager.getFormsFolder();
Java:
Form form = FormManager.get("form_name");
Java:
FormManager.exists("form_name");
Java:
FormManager.load("form_name", file);
Your executor:
Java:
public class YourExecutor implements Executor {
/**
* @param player Player
* @param value Value of action
*/
@Override
public void execute(Player player, String value) {
// Handling action
}
}
Java:
// name - Executor name. For example: YOUR_EXECUTOR
ExecutorManager.register("name", new YourExecutor());
Java:
ExecutorManager.getExecutor("YOUR_EXECUTOR");
Name | Cancellable | Description |
FormLoadEvent | true | Called when the form is loaded |
FormSendEvent | true | Called when a form is opened |