BetterForms

Code
Warning

Depend: Geyser or Floodgate

This is an addon for those who want to work with Bedrock Forms, in BetterGUI’s style.

Get Started

After downloading, follow this guide to install the addon.

Subsections of BetterForms

Modal Form

This is a simple form with 2 buttons.

Format

menu-settings:
  menu-type: modal-form

  # The title of the form
  title: <name>

  # The content of the form
  content: <content>

  # The actions when the player opens the form
  open-action:
  - action
  - action
  - action
  ...

  # The actions when the player closes the form
  close-action:
  - action
  - action
  - action
  ...

  # The actions when the player does something invalid in the form
  invalid-action:
  - action
  - action
  - action
  ...

  # The actions when the player is not a Bedrock player
  java-action:
  - action
  - action
  - action
  ...

  # The requirement before the player can open the form
  view-requirement:
    <requirement-set>
    <requirement-set>
    <requirement-set>
    ...

  # The permission required to open the form
  permission: bettergui.test

  # The command to open the form
  command:
  - command1
  - command2
  ...

  # The list of argument processors to process the arguments of the command to open the form
  argument-processor:
    <argument-processor>
    <argument-processor>

# The first button
button1:
  # The text of the button
  text: <text>

  # The actions when clicking the button
  action:
  - action
  - action
  - action
  ...

  # The requirement to check when clicking the button
  click-requirement:
    <requirement-set>
    <requirement-set>
    <requirement-set>
    ...

# The second button
button2:
  # The text of the button
  text: <text>

  # The actions when clicking the button
  action:
  - action
  - action
  - action
  ...

  # The requirement to check when clicking the button
  click-requirement:
    <requirement-set>
    <requirement-set>
    <requirement-set>
    ...

Note

  • open-action: the Action when the menu is opened.
  • close-action: the Action when the menu is closed.
  • invalid-action: the Action when the player does something invalid.
  • java-action: the Action when the player is not a Bedrock player.
  • view-requirement: the Requirement to check before opening the menu. If it is not met, the menu will not be opened.
  • argument-processor: the Argument Processor to handle the arguments of the command to open the menu.

Button

  • action: the Action when the button is clicked.
  • click-requirement: the Requirement to check when the button is clicked. If it is not met, the action will not be executed.

Example

menu-settings:
  menu-type: modal-form
  command: modalform
  title: "Modal Form"
  content: "&eAre you beautiful, &f{player} &e?"

  open-action: "tell: &eYou opened the form"
  close-action: "tell: &cYou closed the form"
  java-action: "tell: &cYou can't open this form because you're not a Bedrock player"

yes:
  text: "&b&lYes"
  click-requirement:
    check-level:
      level:
        value: 10
        take: false
      success-action: "tell: &eThanks for paticipating the form"
      fail-action: "tell: &eImprove yourself..."

no:
  text: "&bNo"
  action: "tell: &aIt's fine, you're beautiful as always"

Example 1 Example 1

Simple Form

This is a form with a list of buttons.

Format

menu-settings:
  menu-type: simple-form

  # The title of the form
  title: <name>

  # The actions when the player opens the form
  open-action:
  - action
  - action
  - action
  ...

  # The actions when the player closes the form
  close-action:
  - action
  - action
  - action
  ...

  # The actions when the player does something invalid in the form
  invalid-action:
  - action
  - action
  - action
  ...

  # The actions when the player is not a Bedrock player
  java-action:
  - action
  - action
  - action
  ...

  # The requirement before the player can open the form
  view-requirement:
    <requirement-set>
    <requirement-set>
    <requirement-set>
    ...

  # The permission required to open the form
  permission: bettergui.test

  # The command to open the form
  command:
  - command1
  - command2
  ...

  # The list of argument processors to process the arguments of the command to open the form
  argument-processor:
    <argument-processor>
    <argument-processor>

# The button
button1:
  # The text of the button
  text: <text>

  # The actions when clicking the button
  action:
  - action
  - action
  - action
  ...

  # The requirement to check when clicking the button
  click-requirement:
    <requirement-set>
    <requirement-set>
    <requirement-set>
    ...

  # The path to the image
  path: <path>

  # The URL to the image
  url: <url>

button2:
  ...

button3:
  ...

Note

  • open-action: the Action when the menu is opened.
  • close-action: the Action when the menu is closed.
  • invalid-action: the Action when the player does something invalid.
  • java-action: the Action when the player is not a Bedrock player.
  • view-requirement: the Requirement to check before opening the menu. If it is not met, the menu will not be opened.
  • argument-processor: the Argument Processor to handle the arguments of the command to open the menu.

Button

  • action: the Action when the button is clicked.
  • click-requirement: the Requirement to check when the button is clicked. If it is not met, the action will not be executed.
  • path: the path to the image displayed in the button. The path is mostly for texture packs
  • url: the URL to the image displayed in the button.

Example

menu-settings:
  menu-type: simple-form
  command: simpleform
  title: "&4&lInfo Form"

profile:
  text: "&cHSGamer"
  url: "https://raw.githubusercontent.com/HSGamer/hsgamer.github.io/main/static/android-chrome-256x256.png"
  command: "tell: &eLink: &fhttps://hsgamer.me/"

bettergui:
  text: "&cBetterGUI"
  url: "https://raw.githubusercontent.com/BetterGUI-MC/.github/main/images/logo.png"
  command: "tell: &eLink: &fhttps://bettergui-mc.github.io/Docs/"

Example 1 Example 1

Custom Form

This is a complex form with a list of input components.

Format

menu-settings:
  menu-type: custom-form

  # The title of the form
  title: <name>

  # The actions when the player opens the form
  open-action:
  - action
  - action
  - action
  ...

  # The actions when the player closes the form
  close-action:
  - action
  - action
  - action
  ...

  # The actions when the player does something invalid in the form
  invalid-action:
  - action
  - action
  - action
  ...

  # The actions when the player is not a Bedrock player
  java-action:
  - action
  - action
  - action
  ...

  # The requirement before the player can open the form
  view-requirement:
    <requirement-set>
    <requirement-set>
    <requirement-set>
    ...

  # The permission required to open the form
  permission: bettergui.test

  # The command to open the form
  command:
  - command1
  - command2
  ...

  # The list of argument processors to process the arguments of the command to open the form
  argument-processor:
    <argument-processor>
    <argument-processor>

# The components
component1:
  <setting>

component2:
  <setting>

component3:
  <setting>

Component

Label

component:
  type: label

  # The component text
  text: <text>

Input

component:
  type: input

  # The component text
  text: <text>

  # The placeholder when there is no value in the input
  placeholder: <placeholder>

  # The default text
  default: <text>
component:
  type: dropdown

  # The component text
  text: <text>

  # The options
  option: <placeholder>

  # The index of the option to choose as the default option
  default: <index>

Slider

component:
  type: slider

  # The component text
  text: <text>

  # The minimum value
  min: <value>

  # The maximum value
  maximum: <value>

  # The step
  step: <value

  # The default value
  default: <value>

Step Slider

component:
  type: step

  # The component text
  text: <text>

  # The options
  option: <placeholder>

  # The index of the option to choose as the default option
  default: <index>

Switch

component:
  type: switch

  # The component text
  text: <text>

  # The default value
  default: <true/false>

Submit Button

button1:
  type: submit

  # The component text
  text: <text>

  # The actions when clicking the button
  action:
  - action
  - action
  - action
  ...

  # The requirement to check when clicking the button
  click-requirement:
    <requirement-set>
    <requirement-set>
    <requirement-set>
    ...

Note

  • open-action: the Action when the menu is opened.
  • close-action: the Action when the menu is closed.
  • invalid-action: the Action when the player does something invalid.
  • java-action: the Action when the player is not a Bedrock player.
  • view-requirement: the Requirement to check before opening the menu. If it is not met, the menu will not be opened.
  • argument-processor: the Argument Processor to handle the arguments of the command to open the menu.

Component

  • action: the Action when the button is clicked.
  • click-requirement: the Requirement to check when the button is clicked. If it is not met, the action will not be executed.

Variable

You can get the value of the component by using the format {form_<component>}, where <component> is the name of the component in the config. For example, use {form_username} to get the value of the component named username.

Example

menu-settings:
  menu-type: custom-form
  command: customform
  title: "&4&lRegister Form"

username:
  type: input
  text: "Username"
  placeholder: "Your username here..."
  default: "{player}"

password:
  type: input
  text: "Password"
  placeholder: "Yout password here..."

remember:
  type: toggle
  text: "Remember"

submit:
  type: submit
  action:
  - "tell: &eYour username is &f{form_username}"
  - "tell: &eYour password is &f{form_password}"
  click-requirement:
    remember-check:
      condition: "{form_remember}"
      fail-action: "tell: &cYour form is lost..."

Example 1 Example 1