Jannyboy11 / InvSee-plus-plus

A bukkit plugin for manipulating player inventories
Other
93 stars 16 forks source link

NoSuchMethodError #9

Closed metabrixkt closed 3 years ago

metabrixkt commented 3 years ago
[14:36:09 ERROR]: [InvSee++] Error while trying to create main-inventory spectator inventory
java.util.concurrent.CompletionException: java.lang.NoSuchMethodError: 'net.minecraft.world.inventory.InventoryCrafting net.minecraft.world.inventory.ContainerPlayer.n()'
        at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314) ~[?:?]
        at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1766) ~[?:?]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:100) ~[PurplaneEP-1.17.1-1.jar:git-PurplaneEP-"d5dccbc"]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[PurplaneEP-1.17.1-1.jar:git-PurplaneEP-"d5dccbc"]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[PurplaneEP-1.17.1-1.jar:git-PurplaneEP-"d5dccbc"]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[?:?]
        at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NoSuchMethodError: 'net.minecraft.world.inventory.InventoryCrafting net.minecraft.world.inventory.ContainerPlayer.n()'
        at com.janboerman.invsee.spigot.impl_1_17_R1.MainNmsInventory.<init>(MainNmsInventory.java:64) ~[?:?]
        at com.janboerman.invsee.spigot.impl_1_17_R1.MainNmsInventory.<init>(MainNmsInventory.java:68) ~[?:?]
        at com.janboerman.invsee.spigot.impl_1_17_R1.InvseeImpl.spectateInventory(InvseeImpl.java:46) ~[?:?]
        at com.janboerman.invsee.spigot.impl_1_17_R1.InvseeImpl.lambda$createOffline$2(InvseeImpl.java:117) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764) ~[?:?]
        ... 6 more

I'm getting this when trying to open someone's inventory. Using private fork of Airplane on purpur/1.17 branch, commit 177d321. None of my patches touch ContainerPlayer class and none of them can affect it. I'm also able to reproduce this on latest Airplane purpur/1.17 177d321.

Using this version https://www.spigotmc.org/resources/invsee.82342/update?update=412054

Jannyboy11 commented 3 years ago

What you're seeing is likely the same issue as mentioned here: https://github.com/Jannyboy11/InvSee-plus-plus/issues/7#issuecomment-877666499 Spigot decided to not bump ther nms revision even though their methods and field names changed, so I had to check for the minecraft version using an api call. (Server#getBukkitVersion(), as can be seen here: https://github.com/Jannyboy11/InvSee-plus-plus/blob/master/Spigot_Common/src/main/java/com/janboerman/invsee/spigot/api/InvseeAPI.java#L207). It seems that in the purpur/1.17 branch of Airplane this method was not updated to return "1.17.1-R0.1-SNAPSHOT". I'm pretty sure this is not an issue in InvSee++, but I'll investigate further tonight.

If you know of more robust ways to do these version checks, then please let me know, because the current method seems to break a lot on every fork of Paper that does not properly maintain its versions. There is already an issue on SpigotMC's jira that mentions the revison not being bumped: https://hub.spigotmc.org/jira/browse/SPIGOT-6628 But I guess I could try to check for CraftMagicNumbers#getMappingsVersion()

Jannyboy11 commented 3 years ago

Fixed as of https://github.com/Jannyboy11/InvSee-plus-plus/commit/6e576f29ae1a0132d20f52321a69ac21467d4624 (no longer reproduces on the latest version of Airplane purpur/1.17)