# InputListener

This utility is a great way to capture a player's next chat message and execute logic based on it. This type of feature is typically used for "confirmation" messages where the user will have to say a certain word or message to confirm or cancel a certain action.

<details>

<summary>Example</summary>

```java
UUID uuid = UUID.randomUUID(); // should be a player's uuid!
InputListener.listen(uuid, event -> {
    if (!(event.originalMessage() instanceof TextComponent text)) return;

    String message = text.content();

    Player player = event.getPlayer();
            
    if (message.equalsIgnoreCase("hi")) {
        player.sendMessage(Component.text("Hello!"));
    }
});
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.ericlmao.com/projects/alumina/inputlistener.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
