Chat input
Ask a player to type something in chat. Works for Bedrock players too.
Docs updated · What changed
On this page
Ask a player to type something in chat. It works for Bedrock players too, unlike anvil or sign input.
Asking for textLink to this section
ChatInput.ask(plugin, player, prompt = "&7Type a name for the home.", onCancel = { openHomes(it, null) }) { text ->
if (text.length > 16) { lang.send(player, "home.too-long"); false } // keep asking
else { createHome(player, text); openHomes(player, null); true } // done
}How it behavesLink to this section
- The open menu is closed, the prompt and a cancel hint are sent, and the player's chat message is cancelled and handed to your code on the main thread.
- Typing a cancel word (
chat-input.cancel-wordsin ALBCore's lang.yml, defaultcancel) or the timeout (default 60 s) runsonCancel.cancelWords = emptyList()gives every message to your handler.