track / plugin

The official Minecraft plugin for Tebex Analytics.
https://analytics.tebex.io
13 stars 9 forks source link

Bukkit plugin does not initialise properly on Paper 1.8.8 #33

Closed refrainsclub closed 1 year ago

refrainsclub commented 1 year ago

I was trying to install the Bukkit plugin on my Paper 1.8.8 server. However it failed to initialise on server start.

In order to debug, I looked at the stack trace. I realised that there was a NullPointerException in the main class when using the method getScheduler().

So I found this repository and opened the main class for the Bukkit implementation. Sure enough, the morePaperLib instance (which powers getScheduler()) was not initialised before use.

Here is the code from the Bukkit implementation's main class.

// Load modules.
try {
    Class.forName("org.bukkit.event.server.ServerLoadEvent");
    registerEvents(new ServerLoadListener(this));
} catch (final ClassNotFoundException ignored) {
    getScheduler().globalRegionalScheduler().runDelayed(this::loadModules, 1);
}

morePaperLib = new MorePaperLib(this);
public GracefulScheduling getScheduler() {
    return morePaperLib.scheduling();
}

As you can see, getScheduler() was called before morePaperLib was initialised. This causes a NullPointerException morePaperLib is null so getScheduler() could not use it.

To fix this, I would initialise morePaperLib sooner so that getScheduler() could use it. However it seems that the plugin has not been thoroughly tested on older versions of Minecraft. So maybe there are more issues.

I tried forking the plugin a few days ago to send a pull request, however the morePaperLib's maven repository was down. So I am making this issue instead.

I would have included the stack trace, however I am currently typing this on mobile and don't have access to logs at the moment. If you need any more information, please let me know!

heychazza commented 1 year ago

Hey buddy,

Thanks a ton for reaching out and reporting this! Especially being a developer yourself and being able to point where the issue remains is super useful.

I've just pushed out v2.0.10 to fix this, https://github.com/track/plugin/releases/tag/2.0.10

Have a lovely day :)