Help
I am working on a plugin updater / version checker.
I will start by sending the code first so it is easier to explain the issue
Since SkUnityService is loaded before onEnable() the static block errors.
java.lang.NullPointerException: Cannot invoke "me.eren.skriptplus.SkriptPlus.getConfig()" because the return value of "me.eren.skriptplus.SkriptPlus.getInstance()" is null
How would I go about doing this?9 Replies
⌛
This post has been reserved for your question.
Hey @eren.! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
What does the getInstance method do? Doesn't it create the instance if necessary?
if it doesn't, what creates the instance?
its the instance of a minecraft spigot plugin
you either
instance = this
or Bukkit.getPluginManager().getPlugin(string)
to get it, no other way as far as i know
i tried both ways
i didnt include the minecraft modding tag because i thought it would be more of a java issue
maybe i should do some sort of loadServices() method rather than loading them in the field?oh I see
so calling
Bukkit.getPluginManager.getPlugin(...)
in the static
block returns null
as well?yes
because the plugin wasnt loaded yet
this works, unless you have a better idea ill close the thread
Can you lazily initialize the API key?
i could
but i would rather not since im also validating the key
oh yeah that's fine as well
you could also do that when initializing it
Post Closed
This post has been closed by <@587604022349791274>.