Hey everyone! I'm having an issue with load priority of my plugins, it depends on NTLibrary and NTLibrary does have an instance static variable that is set on load, but it gives me this error: [05:36:03 INFO]: [NTLibrary] Enabling NTLibrary v1.0.0* [05:36:03 INFO]: [NTLibrary] [ACF] Enabled Asynchronous Tab Completion Support! [05:36:03 INFO]: [ViaBackwards] Enabling ViaBackwards v4.8.1 [05:36:03 INFO]: [Basic] Enabling Basic v1.0.0* [05:36:03 INFO]: [Basic] [ACF] Enabled Asynchronous Tab Completion Support! [05:36:03 ERROR]: Error occurred while enabling Basic v1.0.0 (Is it up to date?) kotlin.UninitializedPropertyAccessException: lateinit property instance has not been initialized at services.neptune.library.bukkit.NTLibraryBukkit$Companion.getInstance(NTLibraryBukkit.kt:17) ~[?:?] at services.neptune.library.bukkit.plugin.NeptuneSpigotPlugin.onEnable(NeptuneSpigotPlugin.kt:22) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794] at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:599) ~[patched_1.16.5.jar:git-Paper-794] at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-794] at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794] at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312] [05:36:03 INFO]: [Basic] Disabling Basic v1.0.0
#Load Priority Issue
1 messages · Page 1 of 1 (latest)
ill send the code
package services.neptune.library.bukkit.plugin
import co.aikar.commands.PaperCommandManager
import org.bukkit.plugin.java.JavaPlugin
import services.neptune.commons.global.styling.Style
import services.neptune.library.bukkit.NTLibraryBukkit
abstract class NeptuneSpigotPlugin : JavaPlugin() {
lateinit var acf: PaperCommandManager
lateinit var style: Style
abstract fun load()
abstract fun enable()
abstract fun disable()
override fun onLoad() {
load()
}
override fun onEnable() {
acf = PaperCommandManager(this)
style = NTLibraryBukkit.instance.style
acf.enableUnstableAPI("help")
style.setCommandManagerFormat(acf)
enable()
}
override fun onDisable() {
disable()
}
}
``` NeptuneSpigotPlugin (basic extends this instead of JavaPlugin)
package services.neptune.library.bukkit
import co.aikar.commands.PaperCommandManager
import lombok.Getter
import org.bukkit.plugin.java.JavaPlugin
import services.neptune.commons.global.mongo.MongoFactory
import services.neptune.commons.global.styling.Style
import services.neptune.commons.global.styling.StyleFactory
import services.neptune.library.bukkit.command.NtLibCommand
import services.neptune.library.bukkit.config.MainConfig
import services.neptune.library.bukkit.menu.MenuManager
import xyz.mkotb.configapi.ConfigFactory
class NTLibraryBukkit : JavaPlugin() {
companion object {
@JvmStatic
lateinit var instance: NTLibraryBukkit
}
private lateinit var manager: PaperCommandManager
lateinit var mainConfig: MainConfig
private var configFactory: ConfigFactory = ConfigFactory.newFactory(this)
@Getter
lateinit var style: Style
@Getter
lateinit var menuManager: MenuManager
lateinit var mongoFactory: MongoFactory
override fun onLoad() {
instance = this
}
override fun onEnable() {
manager = PaperCommandManager(this)
manager.enableUnstableAPI("help")
manager.registerCommand(NtLibCommand())
mainConfig = configFactory.fromFile("config", MainConfig::class.java)
style = StyleFactory().getStyle(StyleFactory.Styles.valueOf(mainConfig.style))
style.setCommandManagerFormat(manager)
if(mainConfig.useMongo) mongoFactory = MongoFactory(mainConfig.databaseUrl)
menuManager = MenuManager(this)
}
}
```NTLibrary plugin main class
it works fine on spigot 1.8 but not 1.16.5
if anyone could help that would be great. ping me if you need any more code snippets
Init the lateinit props in constructor
? wdym
like make a constructor in the ntlib plugin main class
and initialize the thing there?
or just initialize it in the companion class
sorry i dont really know terminology like that
Set values to lateinit vars in the constructor
companion object {
@JvmStatic
lateinit var instance: NTLibraryBungee
}
constructor() {
instance = this
}
like that??
kotlin dont work like that
@JvmStatic @Nullable
var instance: NTLibraryBungee
cant do that
Bro the ?
Remove lateinit
Property must be initialized or be abstract
set to null
the weird thing is it worked fine the old way on 1.8
but 1.16.5 it stopped working
lets see if this works
Prob not
yeah no
but
whats weird is its saying lateinit property hasnt been initialized still
The acf and style not inited in the constructor
even though its not lateinit anymore
thats because theyre initialized in the onEnable method
because thats when they would be initialized if i was doing a normal plugin
man this is annoying
like why does it just not work on a version of minecraft while it works on another
Bro
especially since this is literally part of kotlin, not the spigot api
but why does it work on 1.8 then
when minecraft version is irrelevant to kotlin features
??
Neptune services 
You may used old versions of kotlin which allowed this
Maybe because reflection standards changed since then
that makes sense
A lot has changed in fact since java 8
Make it nullable
im still using java 8
on the 1.16.5 plugin
but java 8 works fine and it works cross-version so
Ah so we found your issue
i want this plugin to work on both 1.8 and 1.16
You can compile with 8 but for 1.16 and above java 17 has to be used for the server
Normally not an issue but it can be if reflection is involved
Yeah
ok i upgraded the server to java 16
now to upgrade the actual plugin projecta
and hope theres not a billion errors
Lol dev fun 
And why lateinit everywere?
because thats how i learned
You could do the Type?
so
now im getting a NullPointerException
so it didnt fix it
all it did is change the way i do the thing that is still randomly broken
Where do you get it
this abstraction of JavaPlugin: ```kt
package services.neptune.library.bukkit.plugin
import co.aikar.commands.PaperCommandManager
import org.bukkit.plugin.java.JavaPlugin
import services.neptune.commons.global.styling.Style
import services.neptune.library.bukkit.NTLibraryBukkit
abstract class NeptuneSpigotPlugin : JavaPlugin() {
lateinit var acf: PaperCommandManager
lateinit var style: Style
abstract fun load()
abstract fun enable()
abstract fun disable()
override fun onLoad() {
load()
}
override fun onEnable() {
acf = PaperCommandManager(this)
style = NTLibraryBukkit.instance!!.style
acf.enableUnstableAPI("help")
style.setCommandManagerFormat(acf)
enable()
}
override fun onDisable() {
disable()
}
}
every plugin that uses that will depend NTLibrary
so NTLibraryBukkit's static instance will have loaded by then
Also, you can just have a val by lazy
apparently me using lateinit isnt the issue
because i tried something else (nullable) and it does the exact same thing
so
What does it do
What errors etc.
[06:22:16 INFO]: [NTLibrary] [ACF] Enabled Asynchronous Tab Completion Support!
[06:22:16 INFO]: [ViaBackwards] Enabling ViaBackwards v4.8.1
[06:22:16 INFO]: [Basic] Enabling Basic v1.0.0*
[06:22:16 INFO]: [Basic] [ACF] Enabled Asynchronous Tab Completion Support!
[06:22:16 ERROR]: Error occurred while enabling Basic v1.0.0 (Is it up to date?)
java.lang.NullPointerException: null
at services.neptune.library.bukkit.plugin.NeptuneSpigotPlugin.onEnable(NeptuneSpigotPlugin.kt:22) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:599) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:831) [?:?```
which is bullshit because it works on minecraft v1.8
And what si line 22
Why is your main class abstract?
style = NTLibraryBukkit.instance!!.style
its not
i did an abstraction of JavaPlugin that automatically handles stuff like acf initialization and style management
also no, java 16 oes not work on minecraft 1.8 for plugins
thanks for making me upgrade to something that doesnt work @proven dock
i didnt know the difference
would that really affect anything to do with the variable for instance not being initialized
now i gotta go downgrade to java 8 again
ffs
val instance: NTLibraryBungee by lazy { this } or smth
Its all part of the helping process. We may be experienced but it dont mean we always have the answers lol
i suppose
nope, that sets instance to the companion object
Oh u don’t want that
What does your plugin.yml look like it in?
i use annotations
@PluginData(
name = "Basic",
version = "1.0.0",
description = "Plugin handling various basic tasks",
depends = [PluginDependency(name = "NTLibrary", soft = false)]
)
which
compiles to
hang on
lemme decomp
depend: [NTLibrary]
name: Basic
description: Plugin handling various basic tasks
main: services.neptune.basic.Basic
version: 1.0.0
it does harddepend it
And in the NTLibraryBungee?
bukkit
U wrote bungee tho
name: NTLibrary
main: services.neptune.library.bukkit.NTLibraryBukkit
description: Library plugin for Neptune Services.
version: 1.0.0
where
it is currently ```kt
companion object {
@JvmStatic
var instance: NTLibraryBukkit? = null
}
but ill recompile and check just in the off chance i changed it and forgot
this is gonna be a major issue if i dont get this fixed
because eventually this core will be used on minecraft servers running new versions
and having it only support 1.8 will not work
[06:39:39 INFO]: [NTLibrary] Enabling NTLibrary v1.0.0*
[06:39:39 INFO]: [NTLibrary] [ACF] Enabled Asynchronous Tab Completion Support!
[06:39:39 INFO]: [ViaBackwards] Enabling ViaBackwards v4.8.1
[06:39:39 INFO]: [Basic] Enabling Basic v1.0.0*
[06:39:39 INFO]: [Basic] [ACF] Enabled Asynchronous Tab Completion Support!
[06:39:39 ERROR]: Error occurred while enabling Basic v1.0.0 (Is it up to date?)
java.lang.NullPointerException: null
at services.neptune.library.bukkit.plugin.NeptuneSpigotPlugin.onEnable(NeptuneSpigotPlugin.kt:22) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:599) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:831) [?:?]
[06:39:39 INFO]: [Basic] Disabling Basic v1.0.0
``` nope
still
When was it set in the library plugin?
on load
override fun onLoad() {
instance = this
}
companion object {
@JvmStatic
var instance: NTLibraryBukkit? = null
}
And it prints out properly if you debug it there?
Debug thank you
but on 1.16 it does this
println instance after setting it i guess
oh
on 1.16: [06:43:42 INFO]: [NTLibrary] Loading NTLibrary v1.0.0 [06:43:42 INFO]: NTLibrary v1.0.0
on 1.8: [NTLibrary] Loading NTLibrary v1.0.0 14.11 01:44:29 [Server] [INFO] NTLibrary v1.0.0
which is really weird
because it does load
before basic
it should be initialized
but for some weird ass reason
its not
It does not print?
assuming thats what the NTLibrary v1.0.0 line is
because it prints that a second time but only for ntlib
does NOT look like a class print tho
Perhaps, though i did think it would print the clas guess tostring is doing weird stuff
Try running some method on it i guess like instance getdesc
Does NTLibrary depend on anything?
no
alright
Is that library yours?
yes
Seems it uses acf?
Gl, gotta go see pt. now hf with ur weird code
Which would mean it does depend on something
it does work
[06:51:23 INFO]: [NTLibrary] Loading NTLibrary v1.0.0 [06:51:23 INFO]: NTLIB DEBUG: NTLibrary v1.0.0 - Library plugin for Neptune Services
oh well like code dependencies yes
ntlib is a plugin in itself
while also being a dependency used by other plugins in my suite
its latest version
I am thinking it has to be a reflection issue
What reflection?
Well acf uses reflection, not sure what their lib does
Try again on 1.8
try debugging again?
But i never seen anyone abstract javaplugin before though
There isn’t muuch reason to
Typically you would use pluginbase if you want to abstract
should i abstract plugin instead
14.11 01:55:27 [Server] [INFO] NTLIB DEBUG: NTLibrary v1.0.0 - Library plugin for Neptune Services```
works on 1.8
Spigot 1.8 right?
That may be your issue and also you do know you are in spigot
Paper is vastly different now
You may be better off getting help in their discord in regards to the changes from 1.8 to latest
Well they know their software is my point
As if
I know paper but not as well as they do
honestly
They’re reasonable and don’t support legacy versions
which pisses me off because im not asking what version i should be using im asking how to fix an error
thats why i didnt want to go to them
Just implement the class in java. Kotlin / java can sideload
Maybe not but they probably can provide an answer in what changed lol
im considering just giving up
which i really dont wanna do because like this core is the future of my development career
Thing is we cant fix an error that doesnt originate from spigot
and it being able to work on modern versions as well
Paper literally has stuff multi threaded that spigot doesnt even touch
yeah but the way they load plugins shouldnt be THAT different
especially since im not using the paper api
im using the spigot api
It can be, its their stuff and free to change like they did with the multi threading chunks and entities
Sure they may implement the spigot api, that doesnt mean how they implement is the exact same. Sometimes implementation detail is important
gonna try using spigot instead of paper
for server software
ok that didnt work
still the same issue
so its nothhing to do with papermc
@novel gate
Is it the exact same?
yes
Then not sure what changed that would cause that issue at least not without being at my computer to check code
so shoudl i just give up for tonight
Might be wise to give it a break and come back when refreshed lol
Before more things break or something else XD
yeah
this really pisses me off
because i need to get this fixed
and not even knowing whats causing the error after hours of work on it is not a good sign
But i am currently at work on my phone. Dont get home for another 6 hours
👍
im going to sleep ill be back in the morning, ping me if you find anything or if you need more info or anything
Ok
@novel gate Anything?