NbtApiException: Method not loaded! 'ITEMSTACK_NMSCOPY'
rxdn opened this issue ยท 7 comments
I'm shading NBTAPI 2.5.0-SNAPSHOT into my plugin. my users on 1.16+ are reporting the following error:
com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.NbtApiException: Method not loaded! 'ITEMSTACK_NMSCOPY'
at com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.utils.nmsmappings.ReflectionMethod.run(ReflectionMethod.java:147) ~[?:?]
at com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.NBTItem.getCompound(NBTItem.java:33) ~[?:?]
at com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.NBTReflectionUtil.setData(NBTReflectionUtil.java:468) ~[?:?]
at com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.NBTCompound.setString(NBTCompound.java:68) ~[?:?]
at com.perkelle.dev.envoys.utils.nbt.a.a(NBTAPI.kt:24) ~[?:?]
at com.perkelle.dev.envoys.envoys.items.contents.d.o(EnvoyItem.kt:83) ~[?:?]
at com.perkelle.dev.envoys.envoys.refill.e.a(EnvoySpawnListener.kt:50) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor152.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.1.jar:git-Paper-98]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.1.jar:git-Paper-98]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.1.jar:git-Paper-98]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.1.jar:git-Paper-98]
at com.perkelle.dev.envoys.envoys.refill.a$a.run(ArmourStandWrapper.kt:76) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R1.scheduler.CraftTask.run(CraftTask.java:99) ~[patched_1.16.1.jar:git-Paper-98]
at org.bukkit.craftbukkit.v1_16_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.1.jar:git-Paper-98]
at net.minecraft.server.v1_16_R1.MinecraftServer.b(MinecraftServer.java:1291) ~[patched_1.16.1.jar:git-Paper-98]
at net.minecraft.server.v1_16_R1.DedicatedServer.b(DedicatedServer.java:377) ~[patched_1.16.1.jar:git-Paper-98]
at net.minecraft.server.v1_16_R1.MinecraftServer.a(MinecraftServer.java:1212) ~[patched_1.16.1.jar:git-Paper-98]
at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:1000) ~[patched_1.16.1.jar:git-Paper-98]
at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.1.jar:git-Paper-98]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]```
Can you do some testing rather the shading is correct because that method is working currently when run normally on 1.16.1. Also, there should be some exceptions when that class got initialized that shows what exactly went wrong.
I can do some more testing tomorrow, however the following message is displayed upon initialisation:
[NBTAPI] Wasn't able to find NMS Support! Some functions may not work!
My apologies, forgot to include it in the original issue.
iirc, it doesn't spit out a stacktrace at that point, just that warning, however I'll verify that tomorrow.
The "Wasn't able to find NMS Support" message gets printed when there's no matching internal version. Are you sure it's the most recent released version/the currently not yet released builds? Another option is that there's a second NBT Api in another plugin but in the same package (incorrect shading?).
Just built against v2.4.1 (latest released on Spigot); same error:
[22:44:05 INFO]: [NBTAPI] [NBTAPI] Found Spigot: v1_16_R1! Trying to find NMS support
[22:44:05 WARN]: [NBTAPI] [NBTAPI] Wasn't able to find NMS Support! Some functions may not work!
[22:44:05 ERROR]: Could not pass event EnvoySpawnEvent to Envoys v5.3.8
com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.NbtApiException: Method not loaded! 'ITEMSTACK_NMSCOPY'
at com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.utils.nmsmappings.ReflectionMethod.run(ReflectionMethod.java:147) ~[?:?]
at com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.NBTItem.getCompound(NBTItem.java:33) ~[?:?]
at com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.NBTReflectionUtil.setData(NBTReflectionUtil.java:468) ~[?:?]
at com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi.NBTCompound.setString(NBTCompound.java:68) ~[?:?]
at com.perkelle.dev.envoys.utils.nbt.a.a(NBTAPI.kt:24) ~[?:?]
at com.perkelle.dev.envoys.envoys.items.contents.d.o(EnvoyItem.kt:83) ~[?:?]
at com.perkelle.dev.envoys.envoys.refill.e.a(EnvoySpawnListener.kt:50) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor11.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.1.jar:git-Paper-44]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.1.jar:git-Paper-44]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.1.jar:git-Paper-44]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.1.jar:git-Paper-44]
at com.perkelle.dev.envoys.envoys.refill.a$a.run(ArmourStandWrapper.kt:76) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R1.scheduler.CraftTask.run(CraftTask.java:99) ~[patched_1.16.1.jar:git-Paper-44]
at org.bukkit.craftbukkit.v1_16_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.1.jar:git-Paper-44]
at net.minecraft.server.v1_16_R1.MinecraftServer.b(MinecraftServer.java:1291) ~[patched_1.16.1.jar:git-Paper-44]
at net.minecraft.server.v1_16_R1.DedicatedServer.b(DedicatedServer.java:377) ~[patched_1.16.1.jar:git-Paper-44]
at net.minecraft.server.v1_16_R1.MinecraftServer.a(MinecraftServer.java:1212) ~[patched_1.16.1.jar:git-Paper-44]
at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:1000) ~[patched_1.16.1.jar:git-Paper-44]
at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.1.jar:git-Paper-44]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Again, it can't find the enum value for 1.16 here, so it's an old version or overlapping classes from another plugin with the same package (com.perkelle.dev.envoys.dependencies.de.tr7zw.nbtapi) and an older version. Worst-case try to load the normal plugin from the spigot page, that should be able to load. If that fails too then it should spit out some more information about whats going on.
Wow I'm dumb - you were right with the wrong version shaded part. I dynamically load dependencies due to the 4MB jar limit. Admittedly, I haven't touched this code for a while, so I had forgotten to bump the version that the plugin downloads, and had only bumped the version in Gradle, which isn't shaded into the plugin. Sorry for wasting your time.
Cheers.