Documentation: API Documentation v1 | API 文档 v1
A simplified Form API for Floodgate, making it easier to create and send forms to Bedrock players from your Java server.
Easy4Form is a Bukkit/Spigot plugin that provides a simplified interface for creating and sending forms to Bedrock players through the Floodgate API. It supports all three types of forms available in Bedrock Edition:
plugins folderTo use Easy4Form as a dependency in your project, you can import it using either Maven or Gradle:
Add the following repository to your pom.xml:
<repositories>
<repository>
<id>enderrealm-public</id>
<url>https://maven.cnb.cool/EnderRealm/public/enderrealm-public-repo/-/packages/</url>
</repository>
</repositories>
Then add the dependency:
<dependencies>
<dependency>
<groupId>cn.enderrealm</groupId>
<artifactId>easy4form</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Add the following repository to your build.gradle:
repositories { maven { url 'https://maven.cnb.cool/EnderRealm/public/enderrealm-public-repo/-/packages/' } }
Then add the dependency:
dependencies { compileOnly 'cn.enderrealm:easy4form:1.0-SNAPSHOT' }
Easy4Form now includes a configuration file (config.yml) with the following options:
# Detection mode for Bedrock players
# Options: floodgate, uuid
detection-mode: floodgate
# UUID prefix for Bedrock players (only used when detection-mode is 'uuid')
uuid-prefix: "00000000-0000"
# Debug mode
debug: false
# API version (currently only v1 is supported)
api-version: "v1"
# Enable migration warnings for deprecated API usage
migration-warnings: true
You can customize the UUID prefix used for detection when in uuid mode.
List<String> buttons = Arrays.asList("Button 1", "Button 2", "Button 3");
Easy4FormAPI.sendSimpleForm(player, "Title", "Content", buttons, response -> {
if (response != null) {
player.sendMessage("You clicked button: " + buttons.get(response));
}
});
Easy4FormAPI.sendModalForm(
player,
"Confirmation",
"Are you sure you want to proceed?",
"Yes",
"No",
response -> {
if (response != null && response) {
player.sendMessage("You confirmed!");
}
}
);
CustomFormBuilder form = Easy4FormAPI.createCustomForm(player, "Settings", response -> {
if (response != null) {
String name = (String) response.get("name");
boolean notifications = (boolean) response.get("notifications");
player.sendMessage("Settings saved!");
}
});
form.input("name", "Name", "Enter your name", player.getName())
.toggle("notifications", "Enable Notifications", true)
.send(player);
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please open an issue on CNB.