Working with the API
Brief introduction to Sonar's API and event system
Sonar is supposed to be an easy-to-use plugin; therefore, the API has been designed to give a developer almost full control over the behavior of the plugin.
Using the API
Before you are actually able to use the API, you will have to add the dependency to your project.
Please make sure you do not include the API in your built Jar file by using compileOnly
instead of implementation
.
Now you are able to access all the main API functions by using Sonar.get()
.
Events
Using Sonar's built-in event system is also not hard. First, you need to create an event listener:
Then, you need to register your event listener using the Sonar API:
And - that's it. Have fun developing! If you have any further questions, please feel free to join the Discord server and ask in the #development chat.
Last updated