understanding events

@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).

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

@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!