-
Notifications
You must be signed in to change notification settings - Fork 5
Events
Sven Rahn edited this page Jul 21, 2020
·
7 revisions
You can listen to the normal Sponge events like so:
registerListener<ClientConnectionEvent.Login> {
// do stuff
}
The receiver of the function (essentially the this) is the Event which is listened for. So in this example you can call:
registerListener<ClientConnectionEvent.Login> {
this.getConnection()
getConnection()
connection
}
All these point to the exact same function.
To make things easier, some events were directly named, so you can write:
onPlayerLogin {
// do stuff
}
You can see all the available short named events in the events.kt.
Here is a helper library script to register Forge events: https://github.com/randombyte-developer/kt-skript/tree/master/lib-scripts/forge-events
Here is a helper library script to register Pixelmon events: https://github.com/randombyte-developer/kt-skript/tree/master/lib-scripts/pixelmon-events Thanks @alexantoniades