Stargate Rewritten

Stargate Rewritten

241 Downloads

java.lang.NoSuchFieldError for spigot 1.15

Thorinwasher opened this issue ยท 2 comments

commented

How to replicate:

  • Click on a sign of an existing portal with an item in your hand

The following stacktrace will be thrown:

[14:37:03] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to Stargate v1.0.0.7-ALPHA
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:320) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:529) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:514) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at org.bukkit.craftbukkit.v1_15_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:437) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.PlayerInteractManager.a(PlayerInteractManager.java:441) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.PlayerConnection.a(PlayerConnection.java:1250) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:27) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:1) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:19) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.TickTask.run(SourceFile:18) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeTask(SourceFile:144) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeNext(SourceFile:118) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.MinecraftServer.aZ(MinecraftServer.java:917) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.MinecraftServer.executeNext(MinecraftServer.java:910) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.awaitTasks(SourceFile:127) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.MinecraftServer.sleepForTick(MinecraftServer.java:894) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:827) [spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.NoSuchFieldError: GLOW_INK_SAC
        at net.TheDgtl.Stargate.listener.PlayerEventListener.itemIsDye(PlayerEventListener.java:131) ~[?:?]
        at net.TheDgtl.Stargate.listener.PlayerEventListener.dyePortalSignText(PlayerEventListener.java:108) ~[?:?]
        at net.TheDgtl.Stargate.listener.PlayerEventListener.handleRelevantClickEvent(PlayerEventListener.java:81) ~[?:?]
        at net.TheDgtl.Stargate.listener.PlayerEventListener.onPlayerInteract(PlayerEventListener.java:66) ~[?:?]
        at jdk.internal.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:316) ~[spigot-1.15.jar:git-Spigot-3b314f5-e2790ae]
        ... 19 more
commented

We might need to use Material.getMaterial() or Material.matchMaterial() instead, since GLOW_INK_SAC didn't exist in 1.15.
If it returns null, GLOW_INK_SAC is definitely not in the player's hand.

commented

Yes, that would probably be better, we probably need to avoid using the Material.GLOW_INK_SAC enum