Skip to content

Commit

Permalink
docs: obtaining event listener instance & unregistering
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbker committed Oct 30, 2023
1 parent c105797 commit 5f3de5e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ event<PlayerJoinEvent>(EventPriority.HIGHEST) {
}
```

If you ever need an instance of the Listener class that the event gets put in to, it's returned by the function. Specifically, it returns `TwilightListener`. This class has a convenience method in for unregistering the listener, it can be used like so:
```kt
val listener = event<PlayerJoinEvent> {
player.sendMessage("Welcome to the server!")
}

listener.unregister()
```

### Ternary Operator
There is a basic ternary operator implementation added which can be used like so:
```kotlin
Expand Down

0 comments on commit 5f3de5e

Please sign in to comment.