Custom Events
Instead of having to extend the org.bukkit.event.Event yourself, you can extend TwilightEvent!
class MyCustomEvent : TwilightEvent() {
}
This is much easier than the standard Bukkit Event system. You dont need to worry about defining handles, etc.
The TwilightEvent also includes a timestamp which provides an Instant for when the event was ran:
// "MyCustomEvent" is a class which extends "TwilightEvent()"
event<MyCustomEvent> {
println("time event was executed: $timestamp")
}
You can also make a TwilightEvent async by passing a true value to the TwilightEvent constructor:
class MyCustomEvent : TwilightEvent(true) {
}
class MyCustomEvent(async: Boolean) : TwilightEvent(async) {
}
Last modified: 21 February 2024