Closed AILANTEL closed 1 year ago
Hi! It looks like the NoteBlock API is not yet initialized at the time you call the playMusic0
method. Have you added it as you plugin's dependency in plugin.yml? Is there any message about NoteBlockAPI in the server's startup log?
I have written the dependencies in my plugin configuration file, and the server has successfully initialized the API.
Every time I try to call the method to play music it will appear
Assuming you are using maven, may I see your pom.xml file?
I am using gradle, this is my build file, please take a look
I see. Please change the implementation
to compileOnly
. I'll update the wiki.
“OK, I will try this method right away
Thank you very much, the solution is very useful, my plugin can now play music normally!
I tried to read your official documentation to use this API, but I always encounter a null pointer error when calling the methods. I checked my code repeatedly, making sure it is consistent with the usage in the official documentation, but the problem still persists. Spigot version 1.16.5, NoteBlockAPI version 1.6.1, server version 1.16.5, every time I call the playMusic0 method, I get a null pointer error. I have attached screenshots of my code and the error below. I put the loadMusic method in the onEnable method. I have also downloaded the NoteBlockAPI jar file and put it in the plugins folder of the server. I used the sout method to print out the Song object startSong and found that it was not null, startSong got the nbs file.![{F27C4C0A-51E3-44b5-AE54-93E4572E9809}](https://github.com/koca2000/NoteBlockAPI/assets/95335008/d2c44557-39a5-4390-83f2-6a4ee5d2375a)