Register event listeners¶
Endstone provides a powerful event system that allows plugins to listen to various events that happen in the server. Let's walk you through registering a simple event listener.
Add event handlers¶
Let's say your plugin want to listen to when a player joins the server and send a message to inform everyone on the server.
Register listeners¶
Now, we need to register our event handlers to the Endstone event system.
By calling self.register_events
, Endstone will look into the object that is passed in as the argument and
register all handlers with a @event_handler
decorator to the event system.
And that's it! Your plugin should now listen to and handle events when player joins. Remember, you can add as many methods as you want to listen to any event.