> For the complete documentation index, see [llms.txt](https://definedoddy.gitbook.io/fluid-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://definedoddy.gitbook.io/fluid-api/listeners/creating-a-listener.md).

# Creating a listener

## Creating the listener <a href="#creating-the-listener" id="creating-the-listener"></a>

To create a new listener, simply instantiate a new **FluidListener** declaring the event type and override the **run()** method:

```java
new FluidListener<>(EVENT.class) {
    @Override
    public void run() {
        EVENT event = getData();
        //RUN SOMETHING
    }
};
```

## Creating a group listener <a href="#creating-the-listener" id="creating-the-listener"></a>

Group listeners are used to create multiple listeners at once, however, you can't use the advanced utilities such as setting delays etc. To create a new group listener, instantiate a new **FluidListener.Group** and add your methods in like you would do in a standard class extending from Bukkit's Listener:

```java
new FluidListener.Group() {
    @EventHandler
    public void(Event event) {
        //RUN SOMETHING
    }
    
    @EventHandler
    public void(AnotherEvent event) {
        //RUN SOMETHING
    }
};
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://definedoddy.gitbook.io/fluid-api/listeners/creating-a-listener.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.
