Chat Input Handler
The ChatInputHandler provides a simple, functional way to prompt players for text input. When a player is "awaiting" input, their next chat message is intercepted, hidden from public chat, and passed directly into a callback function.
This is highly useful for creating setup wizards, renaming items, or answering prompts without requiring complex command structures or anvil GUIs.
Requesting Input
To request input from a player, use the ChatInputHandler.await() method. You provide the target player, the callback logic (a Consumer<String>), and an optional custom prompt to display.
Using Timeouts
You can pass an additional long parameter representing server ticks to apply a timeout to the request. If the player does not type anything in chat before the timeout expires, the request is silently cancelled, and they are notified.
Cancelling Requests
If you need to manually abort an active input request (for example, if the player closes a menu or logs out), you can forcefully remove them from the waiting map.
Available Methods
Below is a summary of all static methods available in the ChatInputHandler.
Method | Description |
|---|---|
| Awaits input indefinitely, displaying a default AbyssalLib prompt to the player. |
| Awaits input indefinitely, displaying your custom formatted |
| Awaits input with a default prompt, expiring after the specified number of server ticks. |
| Awaits input with a custom prompt, expiring after the specified number of server ticks. |
| Manually aborts an active input request for the specified player. Returns |