Maximvdw / SpigotSite-API

Spigot Site API
24 stars 11 forks source link

Error when trying to access the ResourceManager or UserManager #5

Open TGWaffles opened 6 years ago

TGWaffles commented 6 years ago

Hey there! We're currently working on developing a bot which can access our spigot account and view the users which have purchased a plugin from us.

We've hit a stumbling block in the development, and whenever we try to run the following line of code: ResourceManager rManager = SpigotSite.getAPI().getResourceManager();, the following error is returned:

java.lang.NullPointerException
    at net.bot_development.development.ManagementBot.App.onMessageReceived(App.java:82)
    at net.dv8tion.jda.core.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:405)
    at net.dv8tion.jda.core.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:84)
    at net.dv8tion.jda.core.handle.MessageCreateHandler.handleDefaultMessage(MessageCreateHandler.java:128)
    at net.dv8tion.jda.core.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:49)
    at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
    at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:1011)
    at net.dv8tion.jda.core.requests.WebSocketClient.onTextMessage(WebSocketClient.java:687)
    at net.dv8tion.jda.core.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:1059)
    at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368)
    at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:270)
    at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:990)
    at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:749)
    at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
    at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
    at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

We were hoping you could help us to understand why this is being caused?

Thanks.

Maximvdw commented 6 years ago

have you initialized the spigot core - check the example projects https://github.com/Maximvdw/SpigotAutoSend/blob/master/src/main/java/be/maximvdw/spigotas/SpigotAutoSend.java