> For the complete documentation index, see [llms.txt](https://docs.mipcraft.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mipcraft.eu/network-manager/api/events.md).

# Events

NetworkManager uses custom event dispatching and standard plugin channel messaging (`nm:channel`) to coordinate actions across the proxy and backend servers.

## Proxy Custom Events (Velocity & BungeeCord)

Developers can listen to these events on their proxy plugins to extend or customize NetworkManager behavior:

| Event Class                      | Description                                                                                                  | Cancellable |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------- |
| `GameSearchEvent`                | Fired when the matchmaking system searches for an optimal game server. Cancel to override matching logic.    | **Yes**     |
| `ServerChangeStateEvent`         | Fired when a backend server state changes (e.g. from `WAITING` to `RUNNING`). Cancel to reject state update. | **Yes**     |
| `PlayerConnectGameEvent`         | Fired when a player is successfully dispatched to a game server.                                             | No          |
| `PlayerDisconnectGameEvent`      | Fired when a player leaves a game server.                                                                    | No          |
| `PlayerDisconnectProxyEvent`     | Fired when a player completely disconnects from the proxy network.                                           | No          |
| `PlayerReconnectProxyEvent`      | Fired when a player switches servers or reconnects to the network.                                           | No          |
| `PlayerDataCreatedEvent`         | Fired when a new player profile is initialized in the database.                                              | No          |
| `PlayerDataDumpedEvent`          | Fired when player sessions and playtimes are about to be saved to the database.                              | No          |
| `PlayerDataSavedEvent`           | Fired immediately after player data is committed to the database.                                            | No          |
| `PlayerExecuteCommandEvent`      | Fired when a player executes a command on the proxy.                                                         | **Yes**     |
| `PlayerRequestHubListProxyEvent` | Fired when a player requests the list of active hubs (e.g. through navigation menus).                        | No          |

## Backend Custom Events (Spigot & Paper)

| Event Class             | Description                                                                                              |
| ----------------------- | -------------------------------------------------------------------------------------------------------- |
| `GamesCountUpdateEvent` | Fired when the backend server receives updated player counts for network-wide game modes from the proxy. |

## Plugin Channel Messaging Protocol (`nm:channel`)

The proxy and backend servers coordinate configurations and actions using the custom `nm:channel` plugin channel.

### Proxy → Backend Messaging

The proxy sends instructions to backend servers:

| Subchannel           | Data Format | Purpose                                                                 |
| -------------------- | ----------- | ----------------------------------------------------------------------- |
| `restart`            | *(Empty)*   | Commands the backend server to shut down cleanly (`Bukkit.shutdown()`). |
| `maintenance_change` | `Boolean`   | Syncs maintenance mode toggles.                                         |
| `motd_change`        | `String`    | Syncs custom MOTD updates.                                              |
| `server_id_info`     | `String`    | Assigns the backend server its configured Server ID.                    |
| `games_per_count`    | `String`    | Sends formatted game counts (e.g. `GameName:Count;GameName2:Count`).    |
| `server_data_gui`    | `String`    | Syncs GUI menu buttons and layout configurations.                       |
| `permissions_sync`   | `JSON`      | Syncs player permission attachment updates to the backend.              |

### Backend → Proxy Messaging

Backend servers send statuses and request actions from the proxy:

| Subchannel                  | Data Format | Purpose                                                                                |
| --------------------------- | ----------- | -------------------------------------------------------------------------------------- |
| `server_status_update`      | `String`    | Notifies that the server changed its game state (e.g. `RUNNING`).                      |
| `request_hub_list`          | `UUID`      | Requests the hub listing for a player.                                                 |
| `hub_list_close`            | `UUID`      | Notifies the proxy that the player closed the hubs GUI.                                |
| `server_status_close`       | `UUID`      | Notifies the proxy that the player closed the server list GUI.                         |
| `send_to_server`            | `String`    | Requests that the proxy send the player to a target server (subject to online checks). |
| `send_to_server_ignore`     | `String`    | Requests that the proxy send the player to a target server, bypassing checks.          |
| `server_request_gui`        | `String`    | Requests that the proxy open a configured navigation GUI for the player.               |
| `server_request_transport`  | `String`    | Initiates transport requests (teleports).                                              |
| `run_bungee_command_player` | `String`    | Executes a proxy-level command as the player.                                          |
| `ban_information`           | `String`    | Commands the proxy to execute a ban on a player.                                       |


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.mipcraft.eu/network-manager/api/events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
