-
Notifications
You must be signed in to change notification settings - Fork 4
Event DSL
MattMX edited this page Nov 22, 2023
·
3 revisions
The Event DSL allows us to create event listeners with ease, not needing to create a class for listeners.
The structure of a DSL event listener is as follows:
event<Event>(plugin instance) {
// your code here
}
To create a welcome message on login we can do this
// where "this" is the plugin instance
event<PlayerJoinEvent>(this) {
player.sendMessage("&7Welcome back &c${player.name}".color())
}
Inside the plugin class you do not need to provide the instance of the plugin as a parameter.