Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalPluginAccessException when plugin uses load: STARTUP #102

Open
JarvisCraft opened this issue Sep 7, 2020 · 2 comments
Open

IllegalPluginAccessException when plugin uses load: STARTUP #102

JarvisCraft opened this issue Sep 7, 2020 · 2 comments
Labels

Comments

@JarvisCraft
Copy link

JarvisCraft commented Sep 7, 2020

Description

Whenever a plugin specifies load property to STARTUP in its plugin.yml there is a chance that early call to API method will cause IllegalPluginAccessException:

[01:53:16] [pool-7-thread-1/INFO]: [NBTAPI] [NBTAPI] Found Spigot: v1_12_R1! Trying to find NMS support
[01:53:16] [pool-7-thread-1/INFO]: [NBTAPI] [NBTAPI] NMS support 'MC1_12_R1' loaded!
[01:53:16] [pool-7-thread-1/INFO]: [NBTAPI] [NBTAPI] Found Gson: class com.google.gson.Gson
[01:53:18] [pool-7-thread-1/WARN]: [NBTAPI] [NBTAPI] Error enabling Metrics!
org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.validate(CraftScheduler.java:488) ~[patched_1.12.2.jar:git-Paper-1618]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:150) ~[patched_1.12.2.jar:git-Paper-1618]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.runTaskLater(CraftScheduler.java:133) ~[patched_1.12.2.jar:git-Paper-1618]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.runTask(CraftScheduler.java:116) ~[patched_1.12.2.jar:git-Paper-1618]
        at {relocated_package}.nbtapi.utils.ApiMetricsLite.<init>(ApiMetricsLite.java:143) ~[?:?]
        at {relocated_package}.nbtapi.utils.MinecraftVersion.init(MinecraftVersion.java:87) ~[?:?]
        at {relocated_package}.nbtapi.utils.MinecraftVersion.getVersion(MinecraftVersion.java:80) ~[?:?]
        at {relocated_package}.nbtapi.utils.nmsmappings.ClassWrapper.<init>(ClassWrapper.java:56) ~[?:?]
        at {relocated_package}.nbtapi.utils.nmsmappings.ClassWrapper.<clinit>(ClassWrapper.java:33) ~[?:?]
        at {relocated_package}.nbtapi.utils.nmsmappings.ReflectionMethod.<clinit>(ReflectionMethod.java:22) ~[?:?]
        at {relocated_package}.nbtapi.NBTContainer.<init>(NBTContainer.java:66) ~[?:?]
< ... >

Specification

The exact dependency is:

<dependency>
    <groupId>de.tr7zw</groupId>
    <artifactId>item-nbt-api</artifactId>
    <version>2.5.0</version>
</dependency>

Running on PaperSpigot 1.12, although this issue seems to be unrelated to the server version.

Possible reason

NBT API attempts to load Metrics provider although it is not yet ready.

Possible fix

Delay call to metrics to Bukkit's first POSTWORLD tick.

@sqlongithub
Copy link

Why was this added to wont fix?

@tr7zw
Copy link
Owner

tr7zw commented Dec 2, 2021

Since it's not a functional issue, just causes a the metrics and probably the update check to fail, while not happening in normal usecases. You have to shade it, and then use the nbtapi before the plugin is enabled. That is not intended(neither from the spigot plugin logic, nor the nbtapi).
If this happens to become a regular issue it could be hotfixed by skipping metrics if there is no loaded plugin, but that's not a proper fix.

@tr7zw tr7zw added the wontfix label Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants