storm345dev / ucars

The repo of ucars(bukkit)
10 stars 9 forks source link

NoSuchMethodError every time an off-hand interaction is made #6

Closed Thatsmusic99 closed 4 years ago

Thatsmusic99 commented 4 years ago

Every time a player attempts to place a car or even simply interact with an item in their offhand, an error is thrown. This is using the latest build of PaperSpigot (347) 1.15.2, along with the latest successful build off Jenkins (#56).

Whilst the error is considered to be on line 1477, its current source seems to be on line 1472, where the plugin attempts to check if the server's name begins with mta: https://github.com/storm345dev/ucars/blob/9d773d493477c08acecc49e46fd09c3fefd943a1/src/main/java/com/useful/ucars/uCarsListener.java#L1472 - judging by the fact the code is still there, this has not been fixed in the failed builds.


java.lang.NoSuchMethodError: org.bukkit.Bukkit.getServerName()Ljava/lang/String;
        at com.useful.ucars.uCarsListener.interact(uCarsListener.java:1477) ~[?:?]
        at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:37) ~[patched_1.15.2.jar:git-Paper-347]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.15.2.jar:git-Paper-347]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.15.2.jar:git-Paper-347]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.15.2.jar:git-Paper-347]
        at org.bukkit.craftbukkit.v1_15_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:471) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.PlayerInteractManager.a(PlayerInteractManager.java:456) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.PlayerConnection.a(PlayerConnection.java:1414) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:27) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:5) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:23) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.TickTask.run(SourceFile:18) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.MinecraftServer.ba(MinecraftServer.java:1104) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.MinecraftServer.executeNext(MinecraftServer.java:1097) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.MinecraftServer.sleepForTick(MinecraftServer.java:1058) ~[patched_1.15.2.jar:git-Paper-347]
        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:973) ~[patched_1.15.2.jar:git-Paper-347]
        at java.lang.Thread.run(Thread.java:834) [?:?]
storm345 commented 4 years ago

I see the issue, and it seems to be your use of 1.15 which is causing the problem, as this plugin is only updated to 1.12 (though I suspect it mostly works fine on newer versions other than this). I have no idea why spigot decided to remove the getServerName() method as it seems like an arbitrary change breaking compatibility for little benefit.

Some point soon I may refactor the code to no longer use that method, but I am not officially maintaining this plugin for public consumption anymore (hence why no official updates to bukkit in a while). This project is however open source so feel free to fork your own version which has this changed :)

Thatsmusic99 commented 4 years ago

Ahh I see. I wasn't sure on keeping the plugin around at first because of it not being updated, but one of my players showed me your Jenkins page so I was assuming from that alone that the project was still active. Plus they do adore it so I figured I'd go ahead and keep it around. ;)

And that's fine! I did have to end support for one of my own projects recently so I fully understand the hassle. I will definitely be sure to fork my own version to work on when I'm updating to newer versions. Thank you for taking the time to answer!

storm345 commented 4 years ago

Pushed a commit removing that line :P No guarantees it'll work on 1.15 but you can try

Thatsmusic99 commented 4 years ago

Damn, that was quick. I'll merge that into my fork now and build it to see what happens. Thanks for doing this!

Thatsmusic99 commented 4 years ago

The error is gone and my console is no longer filled with it. Thanks once again for addressing this so quickly, even if it was out of version support!