That is the minecraft version of the java's Scanner class.
REQUIRES A BETA VERSION OF SERVER MODULE.
It gets what the players write in chat waiting for the result to be something before continuing.
Changelog v1.0
- created ChatInput class
- created nextLine() for strings
- created nextFloat() for numbers
- created nextBool() for booleans
- created close() to close the input stream
Usage Example:
// creating the input scanner for player
const input = new ChatInput(player);
// use async to wait for the result to continue
(async () => {
//getting the values
player.sendMessage("<question> Type something:")
const string = await input.nextLine();
player.sendMessage("<question> Type a number:")
const float = await input.nextFloat();
player.sendMessage("<question> Type yes or no:")
const bool = await input.nextBool()
//closing the input
input.close()
// sending the result
player.sendMessage("<result data> RESULT:")
player.sendMessage("<result data> text: " + string)
player.sendMessage("<result data> number: " + float)
player.sendMessage("<result data> bool: " + bool)
})();