NullPointerException [NBTReflectionUtil#getItemRootNBTTagCompound] (NBTReflectionUtil:185)
egg82 opened this issue ยท 4 comments
NPE at NBTReflectionUtil:185
POE from my library is here with specific line referenced here.
Full stacktrace:
NullPointerException
at de.tr7zw.itemnbtapi.NBTReflectionUtil.getItemRootNBTTagCompound (NBTReflectionUtil.java:185)
at de.tr7zw.itemnbtapi.NBTItem.getCompound (NBTItem.java:15)
at de.tr7zw.itemnbtapi.NBTReflectionUtil.hasKey (NBTReflectionUtil.java:815)
at de.tr7zw.itemnbtapi.NBTCompound.hasKey (NBTCompound.java:136)
at me.egg82.tcpp.lib.ninja.egg82.nbt.core.NBTAPICompound.hasTag (NBTAPICompound.java:21)
at me.egg82.tcpp.events.inventory.inventoryClick.AttachEventCommand.onExecute (AttachEventCommand.java:119)
at me.egg82.tcpp.lib.ninja.egg82.patterns.SynchronousCommand.start (SynchronousCommand.java:40)
at me.egg82.tcpp.events.InventoryClickEventCommand.lambda$onExecute$0 (InventoryClickEventCommand.java:38)
at java.util.ArrayList.forEach (ArrayList.java:1249)
at me.egg82.tcpp.events.InventoryClickEventCommand.onExecute (InventoryClickEventCommand.java:36)
at me.egg82.tcpp.lib.ninja.egg82.patterns.SynchronousCommand.start (SynchronousCommand.java:40)
at me.egg82.tcpp.lib.ninja.egg82.plugin.reflection.event.EventListener_1_8.onAnyEvent (EventListener_1_8.java:802)
at me.egg82.tcpp.lib.ninja.egg82.plugin.reflection.event.EventListener_1_8.onInventoryClick (EventListener_1_8.java:378)
at sun.reflect.GeneratedMethodAccessor498.invoke ([unknown]:-1)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.bukkit.plugin.java.JavaPluginLoader$1.execute (JavaPluginLoader.java:306)
at org.bukkit.plugin.RegisteredListener.callEvent (RegisteredListener.java:62)
at org.bukkit.plugin.SimplePluginManager.fireEvent (SimplePluginManager.java:502)
at org.bukkit.plugin.SimplePluginManager.callEvent (SimplePluginManager.java:487)
at net.minecraft.server.v1_8_R3.PlayerConnection.a (PlayerConnection.java:1630)
at net.minecraft.server.v1_8_R3.PacketPlayInWindowClick.a (SourceFile:31)
at net.minecraft.server.v1_8_R3.PacketPlayInWindowClick.a (SourceFile:9)
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run (SourceFile:13)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at net.minecraft.server.v1_8_R3.SystemUtils.a (SourceFile:44)
at net.minecraft.server.v1_8_R3.MinecraftServer.B (MinecraftServer.java:715)
at net.minecraft.server.v1_8_R3.DedicatedServer.B (DedicatedServer.java:374)
at net.minecraft.server.v1_8_R3.MinecraftServer.A (MinecraftServer.java:654)
at net.minecraft.server.v1_8_R3.MinecraftServer.run (MinecraftServer.java:557)
at java.lang.Thread.run (Thread.java:745)
I found the source
[13:45:56 WARN]: java.lang.NoSuchMethodException: org.bukkit.inventory.ItemStack.getTag()
[13:45:56 WARN]: at java.base/java.lang.Class.getMethod(Unknown Source)
[13:45:56 WARN]: at de.tr7zw.itemnbtapi.NBTReflectionUtil.getItemRootNBTTagCompound(NBTReflectionUtil.java:232)
[13:45:56 WARN]: at git.jw.itemdrop.ItemDrop.onEnable(ItemDrop.java:49)
[13:45:56 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[13:45:56 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337)
[13:45:56 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403)
[13:45:56 WARN]: at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:381)
[13:45:56 WARN]: at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:330)
[13:45:56 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:422)
[13:45:56 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:383)
[13:45:56 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:338)
[13:45:56 WARN]: at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:272)
[13:45:56 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545)
[13:45:56 WARN]: at java.base/java.lang.Thread.run(Unknown Source)
[13:45:56 INFO]: |||||||||null
Not sure what happened here. In the Stacktrace at the top the ItemStack was null, so the NullPointer was totally correct. Why an access to org.bukkit.inventory.ItemStack.getTag() and not net.minecraft.server.v1__R.ItemStack.getTag() happened... no clue. Probably somewhere a .getClass resulted in using the wrong class for the reflection, which is fixed using the new reflection system.