Input Prompt
Info
Available for LabyMod users with version greater than 3.7.7
Overview
With this feature it is possible to request a text input from a player. The server can send any text with any pre-entered input to the client.

Requirements
Example code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | /**
* @param player The input prompt receiver
* @param promptSessionId A unique id for each packet, use a static number and increase it for each prompt request
* @param message The message above the text field
* @param value The value inside of the text field
* @param placeholder A placeholder text inside of the text field if there is no value given
* @param maxLength Max amount of characters of the text field value
*/
public void sendInputPrompt( Player player, int promptSessionId, String message, String value, String placeholder, int maxLength ) {
JsonObject object = new JsonObject();
object.addProperty( "id", promptSessionId );
object.addProperty( "message", message );
object.addProperty( "value", value );
object.addProperty( "placeholder", placeholder );
object.addProperty( "max_length", maxLength );
LMCUtils.sendLMCMessage( player, "input_prompt", object );
}
|
The client will send the following response with the input_prompt
key after closing the GUI:
| {
"id": <promptSessionId as integer>,
"value": "<The given input of the player>"
}
|