Closed Rumsfield closed 2 months ago
There is a major problem with the Spigot 1.21 API in regards to the InventoryView
class changing into an interface. When the plugin uses the 1.21 API as a dependency, all GUI menus and inventory listeners in Konquest break. For example, using the 1.21 API to compile Konquest, running on a 1.20.6 server:
[15:35:13 ERROR]: Could not pass event InventoryClickEvent to Konquest v1.4.3
java.lang.IncompatibleClassChangeError: Found class org.bukkit.inventory.InventoryView, but interface was expected
at Konquest-1.4.3.jar/com.github.rumsfield.konquest.listener.InventoryListener.onDisplayMenuClick(InventoryListener.java:212) ~[Konquest-1.4.3.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor115.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:81) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:1.20.6-147-e41d44f]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleContainerClick(ServerGamePacketListenerImpl.java:3177) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:69) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:33) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:55) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1511) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:195) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1488) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1411) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1377) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1238) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323) ~[paper-1.20.6.jar:1.20.6-147-e41d44f]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
The issue is that when Konquest is compiled with InventoryView
as an interface with the 1.21 API, it will not work in server versions before 1.21, because the servers API expects that InventoryView
is a class. I'm not sure if there's a solution for full backwards compatibility here. There may have to be multiple modules in the project to compile with the appropriate API target.
This problem goes away when the 1.20.6 API is used as a dependency in Konquest, and the plugin works on previous versions. I have not yet tested on a 1.21 server.
There are many compatibility changes that need to be addressed. Notably:
https://www.spigotmc.org/threads/spigot-bungeecord-1-20-5.645069/
Also minimum required Java version will be 21.