JorelAli / CommandAPI

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13

Home Page:https://commandapi.jorel.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.lang.NoClassDefFoundError: commandapi/commandsenders/BukkitConsoleCommandSender

TheDevMinerTV opened this issue · comments

CommandAPI version

9.0.3

Minecraft version

1.20.1

Are you shading the CommandAPI?

Yes

What I did

  • Register a normal command via new CommandAPICommand() on Paper (or Folia)
  • Run that command through the server console

What actually happened

[00:00:10 ERROR]: [io.papermc.paper.threadedregions.TickRegionScheduler] Region #-1 centered at chunk null in world 'null' failed to tick:
org.bukkit.command.CommandException: Unhandled exception executing 'mcutils maintenance kick' in org.bukkit.craftbukkit.v1_20_R1.command.VanillaCommandWrapper(mcutils)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:165) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:1048) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.lambda$dispatchCmdAsync$1(CraftServer.java:1000) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at io.papermc.paper.threadedregions.RegionizedServer$GlobalTickTickHandle.runOneTask(RegionizedServer.java:163) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at io.papermc.paper.threadedregions.RegionizedServer$GlobalTickTickHandle.drainTasks(RegionizedServer.java:153) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at io.papermc.paper.threadedregions.RegionizedServer$GlobalTickTickHandle.tickRegion(RegionizedServer.java:148) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:385) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:525) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NoClassDefFoundError: army/place/mcutils/folia/commandapi/commandsenders/BukkitConsoleCommandSender
        at army.place.mcutils.folia.commandapi.CommandAPIBukkit.wrapCommandSender(CommandAPIBukkit.java:390) ~[mcutils-folia-1.0.0.jar:?]
        at army.place.mcutils.folia.commandapi.nms.NMS_Common.getCommandSenderFromCommandSource(NMS_Common.java:434) ~[mcutils-folia-1.0.0.jar:?]
        at army.place.mcutils.folia.commandapi.nms.NMS_Common.getCommandSenderFromCommandSource(NMS_Common.java:141) ~[mcutils-folia-1.0.0.jar:?]
        at army.place.mcutils.folia.commandapi.CommandAPIHandler.lambda$generatePermissions$1(CommandAPIHandler.java:346) ~[mcutils-folia-1.0.0.jar:?]
        at com.mojang.brigadier.tree.CommandNode.canUse(CommandNode.java:79) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at com.mojang.brigadier.CommandDispatcher.parseNodes(CommandDispatcher.java:360) ~[folia-1.20.1.jar:?]
        at com.mojang.brigadier.CommandDispatcher.parse(CommandDispatcher.java:350) ~[folia-1.20.1.jar:?]
        at com.mojang.brigadier.CommandDispatcher.parse(CommandDispatcher.java:318) ~[folia-1.20.1.jar:?]
        at net.minecraft.commands.Commands.performPrefixedCommand(Commands.java:303) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R1.command.VanillaCommandWrapper.execute(VanillaCommandWrapper.java:45) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        ... 8 more
Caused by: java.lang.ClassNotFoundException: army.place.mcutils.folia.commandapi.commandsenders.BukkitConsoleCommandSender
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
        at army.place.mcutils.folia.commandapi.CommandAPIBukkit.wrapCommandSender(CommandAPIBukkit.java:390) ~[mcutils-folia-1.0.0.jar:?]
        at army.place.mcutils.folia.commandapi.nms.NMS_Common.getCommandSenderFromCommandSource(NMS_Common.java:434) ~[mcutils-folia-1.0.0.jar:?]
        at army.place.mcutils.folia.commandapi.nms.NMS_Common.getCommandSenderFromCommandSource(NMS_Common.java:141) ~[mcutils-folia-1.0.0.jar:?]
        at army.place.mcutils.folia.commandapi.CommandAPIHandler.lambda$generatePermissions$1(CommandAPIHandler.java:346) ~[mcutils-folia-1.0.0.jar:?]
        at com.mojang.brigadier.tree.CommandNode.canUse(CommandNode.java:79) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at com.mojang.brigadier.CommandDispatcher.parseNodes(CommandDispatcher.java:360) ~[folia-1.20.1.jar:?]
        at com.mojang.brigadier.CommandDispatcher.parse(CommandDispatcher.java:350) ~[folia-1.20.1.jar:?]
        at com.mojang.brigadier.CommandDispatcher.parse(CommandDispatcher.java:318) ~[folia-1.20.1.jar:?]
        at net.minecraft.commands.Commands.performPrefixedCommand(Commands.java:303) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R1.command.VanillaCommandWrapper.execute(VanillaCommandWrapper.java:45) ~[folia-1.20.1.jar:git-Folia-"9f9cd27"]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        ... 8 more

What should have happened

The command should've ran without issues.

Server logs and CommandAPI config

No response

Other

This only appears to happen some of the time and I'm not sure why. The class it's trying to find is in the plugin JAR file.
image

Dependencies:

  compileOnly "dev.jorel:commandapi-bukkit-core:9.0.3"
  shadow(implementation("dev.jorel:commandapi-bukkit-shade:9.0.3"))

Relocation:

  relocate "dev.jorel.commandapi", "army.place.mcutils.folia.commandapi"

Hmm, that is weird. Would you be able to post the full server log? (https://paste.gg/ is nice for that) I'm wondering if something is reloading the plugin and unloading that class, or maybe the plugin never loaded properly in the first place.

... on Paper (or Folia)

This is happening on Paper and Folia? If it also happens on Paper, I guess that's good news that is is not just some weird Folia thing.

CommandAPI version
9.0.3

You could try updating to version 9.1.0 and see if that helps. There was a bugfix in 9.1.0 related to Paper/Folia stuff (https://github.com/JorelAli/CommandAPI#changelog). I wouldn't expect that to solve the problem, but it is worth a try.

Would you be able to post the full server log?

Sadly the server logs contain all the private /msgs from ~50 players, so I guess not.

This is happening on Paper and Folia? If it also happens on Paper, I guess that's good news that is is not just some weird Folia thing.

I haven't tested what happens on Paper, only Folia. Maybe I've just messed up some shading configuration.

You could try updating to version 9.1.0 and see if that helps

I'll try ^^

Your dependencies look weird. If you're shading the CommandAPI, you only need to add commandapi-bukkit-shade - you do not need to add commandapi-bukkit-core. I presume because you're relocating, the compiler may be linking against commandapi-bukkit-core which may be screwing things up for you.

I've updated CommandAPI to v9.1.0 and removed commandapi-bukkit-core. I'll update here if it happens again after the next server restart ^^

That seems to have fixed it, thank you for pointing the issue out!

Classic skill issue on my part. Closing...