> For the complete documentation index, see [llms.txt](https://asrob-uc3m.gitbook.io/robotdevastation-developer-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asrob-uc3m.gitbook.io/robotdevastation-developer-manual/robotdevastation/managers/data-management/listening-to-events.md).

# Listening to Events

When a class needs to receive events related to the stored game data, such as a player being hit, or respawned, it must implement the `MentalMapEventListener` interface. Once registered in the `MentalMap`, it will receive data-related events each time a change in the game data occurs.

## MentalMapEventListener

This interface has the following functions, that are called when the corresponding event is triggered in the `MentalMap`:

* `onTargetHit()`: this function will be called whenever a target is hit.
* `onRespawn()`: this function will be called whenever the player is respawned.
