# understanding events

```csharp
@Katton.listen("event_name")
function handlerName(event) {
    // do something with "event"
}
```

* `@Katton.listen(...)` always takes exactly **one** string which is the event name
* the function always takes exactly **one** parameter called `event`
* theres only a limited amount of events (see [event list & properties](event-list.md)).

### `player_join` and `player_quit` are NOT server connect/disconnect

* **`player_join`** fires when a player **enters** `the arena`
* **`player_quit`** fires when a player **leaves** `the arena`

if you want "a player connected to the server" or "a player disconnected", Katton doesn't expose that directly

```csharp
@Katton.listen("player_join")
function onArenaEnter(event) {
    event.player.sendMessage("&aWelcome!")
}

@Katton.listen("player_quit")
function onArenaLeave(event) {
    // fires when they leave the arena
}
```

### next!

* [event list & properties](event-list.md), every event name and what you can read off it
* [cancelling events](cancelling-events.md), how and when `event.cancel()` actually does something
