AnvilGUI: NoClassDefFoundError on 1.20.6

Just upgraded server version and anvilgui and now I can’t use it.

Version

This server is running Paper version 1.20.6-112-master@347bbe3 (2024-05-26T22:17:48Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT) You are running the latest version Previous version: 1.20.6-90-b149584 (MC: 1.20.6)

Error

[08:11:23 WARN]: java.lang.NoClassDefFoundError: Could not initialize class me.usainsrht.sccore.anvilgui.AnvilGUI
[08:11:23 WARN]:        at SCCore-1.3.2.jar//me.usainsrht.sccore.anvilgui.AnvilGUI$Builder.<init>(AnvilGUI.java:400)
[08:11:23 WARN]:        at SCClaims-1.0.7.jar//me.usainsrht.scclaims.commands.ClaimCommand.execute(ClaimCommand.java:70)
[08:11:23 WARN]:        at io.papermc.paper.command.brigadier.bukkit.BukkitCommandNode$BukkitBrigCommand.run(BukkitCommandNode.java:86)
[08:11:23 WARN]:        at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73)
[08:11:23 WARN]:        at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:31)
[08:11:23 WARN]:        at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:19)
[08:11:23 WARN]:        at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8)
[08:11:23 WARN]:        at net.minecraft.commands.execution.CommandQueueEntry.execute(CommandQueueEntry.java:5)
[08:11:23 WARN]:        at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:103)
[08:11:23 WARN]:        at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:442)
[08:11:23 WARN]:        at net.minecraft.commands.Commands.performCommand(Commands.java:349)
[08:11:23 WARN]:        at net.minecraft.commands.Commands.performCommand(Commands.java:336)
[08:11:23 WARN]:        at net.minecraft.commands.Commands.performCommand(Commands.java:331)
[08:11:23 WARN]:        at net.minecraft.server.network.ServerGamePacketListenerImpl.performUnsignedChatCommand(ServerGamePacketListenerImpl.java:2202)
[08:11:23 WARN]:        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$14(ServerGamePacketListenerImpl.java:2176)
[08:11:23 WARN]:        at net.minecraft.server.TickTask.run(TickTask.java:18)
[08:11:23 WARN]:        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151)
[08:11:23 WARN]:        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24)
[08:11:23 WARN]:        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1511)
[08:11:23 WARN]:        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:195)
[08:11:23 WARN]:        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125)
[08:11:23 WARN]:        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1488)
[08:11:23 WARN]:        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1411)
[08:11:23 WARN]:        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135)
[08:11:23 WARN]:        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1377)
[08:11:23 WARN]:        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1238)
[08:11:23 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323)
[08:11:23 WARN]:        at java.base/java.lang.Thread.run(Thread.java:1583)
[08:11:23 WARN]: Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: net/minecraft/world/entity/player/EntityHuman [in thread "Server thread"]
[08:11:23 WARN]:        at java.base/java.lang.Class.forName0(Native Method)
[08:11:23 WARN]:        at java.base/java.lang.Class.forName(Class.java:534)
[08:11:23 WARN]:        at java.base/java.lang.Class.forName(Class.java:513)
[08:11:23 WARN]:        at io.papermc.reflectionrewriter.runtime.AbstractDefaultRulesReflectionProxy.forName(AbstractDefaultRulesReflectionProxy.java:68)
[08:11:23 WARN]:        at io.papermc.paper.pluginremap.reflect.PaperReflectionHolder.forName(Unknown Source)
[08:11:23 WARN]:        at SCCore-1.3.2.jar//me.usainsrht.sccore.anvilgui.version.VersionMatcher.match(VersionMatcher.java:43)
[08:11:23 WARN]:        at SCCore-1.3.2.jar//me.usainsrht.sccore.anvilgui.AnvilGUI.<clinit>(AnvilGUI.java:42)
[08:11:23 WARN]:        ... 28 more

Code

    public boolean execute(@NotNull CommandSender commandSender, @NotNull String cmd, @NotNull String[] args) {
        if (args.length > 0) {
            if (commandSender instanceof Player player) {
                if (args[0].equalsIgnoreCase("debug") && commandSender.hasPermission("scclaims.command.debug")) {
                    if (args[1].equalsIgnoreCase("anvilgui")) {
                        try {
                            new AnvilGUI.Builder().plugin(SCClaims.getInstance())
                                    .title(args[2])
                                    .itemLeft(new ItemStack(Material.GRASS_BLOCK))
                                    .open(player);
                        } catch (Exception | Error e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
        }
    }

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 31 (14 by maintainers)

Most upvoted comments

I am using my fork in my plugins (the no_relocation branch), so you can expect that I will keep maintaining that fork.

Fair point, and I do agree that it may be feasible, I just don’t think it’s very necessary. Even if the Mojang mappings don’t change as often, supporting them in addition to the Spigot mappings is extra work and makes the code more complicated.

It is necessary to have mojang mappings in the repo, since people are using paper plugins and/or don’t want to use spigot mappings. We don’t want to rely on the remapper, it takes some time to remap spigot to mojang as Boy0000 mentioned.

Supporting two mappings isn’t really a problem, we can keep all the “legacy” NMS spigot mapped modules for versions < 1.20.5 and for the NMS modules from 1.20.6 on use the paper mappings. This is what I already do in my fork. It uses the paperweight-userdev gradle plugin, so we can aswell generate a jar file with the spigot-mapped sources using the userdev plugin. This would generate a jar file with everything spigot-mapped.

From this point on we can build artifacts containing only spigot mapped classes, only mojang mapped classes and a combination of both. Devs who want to target the paper platform can use the mojang-mapped artifact, and those who want to support both spigot and paper the combinated version.

@mastercake10 thank you worked perfectly 👍 , just had to add 1.21 compat

image

Is there no real way to use this with a paper plugin and mojang mappings anymore?

No, there is no way to use spigot mappings for paper plugins. The server expects the paper plugin to use mojang mappings. So it needs an AnvilGUI API that has mojang mappings in it. I have a fork of AnvilGUI that has both mojang and spigot mappings in it, which (I think) should work with paper plugins, as mentioned here https://github.com/WesJD/AnvilGUI/issues/330#issuecomment-2133673489.

Yes, adding spigot paperweight mapping namespace solved the problem but wouldn’t it cause other issues if someone uses both mojang mapping nms and anvilgui at the same time?

only if your plugin’s MANIFEST.MF states that its using Mojang mappings. Otherwise the paper-remapper would automatically remap everything that is not mojang.

The jar you’re using right now (my no-relocation branch) has both mappings in it, so it works on both paper and spigot. I don’t know if there is any advantage in distributing two jar files. With both mappings in it, one could target paper and spigot at the same time.

I didn’t know that these paper plugins were a thing, so I think I will create a PR soon for my fork.

Lets leave this issue open until its officially resolved.