-
Notifications
You must be signed in to change notification settings - Fork 0
CustomForm
CustomForm (FormAPI/customui/PocketMine name: CustomForm
, MCPE network name: custom_form
) is a client builtin form type that shows an arbitrary number of elements in the order given by the server. Elements can be read-only or editable (requires a value input).
For non-players, elements are sent as messages one by one, until an editable element requires a value, then the user is required to run the cont command.
For players: Similar to a <p>
in HTML, displaying the text in the text
UserString attribute.
For non-players: Sends a line containing data in the text
attribute.
For players: Similar to <label> <input type="text">
in HTML. The text
UserString attribute is displayed in the label. The placeholder
UserString attribute is displayed as gray text in the input if there is no input. The default
attribute is set as the default string as-is.
For non-players: Sends these lines:
[?] TEXT
Answer by typing: CONT_NAME <PLACEHOLDER>`
Default: DEFAULT
CONT_NAME
is the detected preferred name for the cont command. TEXT
is the text
UserString attribute. PLACEHOLDER
is the placeholder
UserString attribute, or "answer" if not set. The last line is only displayed if the default
attribute is set, and the default
value will be used if the user runs the cont command without arguments.
default
is an empty string if no default
is provided.
For players: Displays the text
UserString attribute, followed by a toggle whose default state is set by the default
boolean attribute.
For non-players: Sends these lines:
[?] TEXT
Answer by typing: CONT_NAME [true|false]
Default: DEfAULT
The default
attribute is false
if not provided.
For players: Displays the text
UserString attribute, followed by a slider that ranges from min
float attribute to max
float attribute. If step
float attribute is zero, the slider is continuous; otherwise, only min + n_step
(where n_step
is a multiple of step
) values are allowed. The default state is set by the default
float attribute.
For non-players: Sends these lines:
[?] TEXT
Answer by typing: CONT_NAME <answer>
Default: DEFAULT
The step
attribute is not displayed, but will be validated together with the bounds when an input has been received.
The default
float attribute is set as min
by default. The step
attribute is set as 0 by default.
For players: <select>
can be displayed in two modes, determined by the mode
attribute: the dropdown
mode (default) is displayed like a <select>
in HTML, and the slider
mode is displayed like a slider (like the render distance option in client settings).
For non-players: Sends these lines:
[?] TEXT
Options: CMD_NAME_N (DISP_NAME_N), CMD_NAME_N (DISP_NAME_N), CMD_NAME_N (DISP_NAME_N), ...
Answer by typing: CONT_NAME <option>
Default: DEFAULT
The options can be either hardcoded or provided dynamically, but not both. Dynamic options are provided by the provider
controller attribute (ListProvider
). The provider is also responsible for assigning the default option. Hardcoded options are provided by <option>
child elements. Each element contains
- a required
displayName
UserString attribute for form UI display - a required
commandName
attribute for command UI input - a required
value
attribute, converted to the value type indicated in thevalueType
attribute of the<select>
. IfvalueType
is not set, the value is not converted and remains as a string. - an optional
default
boolean attribute to indicate which option is the default option. The first option is used if none of the children have this attribute set to true.