Skip to main content
Version: 0.5.1

EventEntry

The EventEntry is used as a starting point for any sequence. It can have external event listeners listening to events and trigger based on that.

Usage

ExampleEventEntry.kt
@Entry("example_event", "An example event entry.", Colors.YELLOW, "material-symbols:bigtop-updates")
class ExampleEventEntry(
override val id: String = "",
override val name: String = "",
override val triggers: List<Ref<TriggerableEntry>> = emptyList(),
) : EventEntry

To listen to an event, you must create a function that is annotated with @EntryListener. The great thing about kotlin, is that this can be done in the same file as the entry.

ExampleEventEntry.kt
// Must be scoped to be public
@EntryListener(ExampleEventEntry::class)
fun onEvent(event: SomeBukkitEvent, query: Query<ExampleEventEntry>) {
// Do something
val entries = query.find() // Find all the entries of this type, for more information see the Query section
// Do something with the entries, for example trigger them
entries triggerAllFor event.player
}
 Public Function

If the function is not scoped to be public, it will not be registered as a listener.

The function will automatically be registered as a listener for the event by Typewriter and be called when the Bukkit event is trigger. An optional Query parameter can be added to easily fetch all the different event entries.