Closed FabianKoder closed 1 month ago
I believe the specific error here happens when Paper thinks your plugin is Spigot-mapped, but the code in your jar is actually Mojang-mapped. Paper tries to remap what it thinks is Spigot-mapped code, but the code is already Mojang-mapped, so it gets double remapped and messes up the bytecode, causing that error. The full server log could help verify this theory, though things matching this have come up before.
If you want your plugin to be Spigot-mapped, you should use the commandapi-bukkit-shade
dependency. If you want your plugin to be Mojang-mapped, you should use the commandapi-bukkit-shade-mojang-mapped
dependency.
Note that if you use a plugin.yml
, Paper will assume your plugin is Spigot-mapped. If you use a paper-plugin.yml
, Paper will assume your plugin is Mojang-mapped. If you would like Paper to treat your plugin differently than it assumes by default, you can declare your mappings in the manifest file, which Paper's documentation describes how to do here: https://docs.papermc.io/paper/dev/project-setup#plugin-remapping.
Looking beyond this specific issue, a lot of developers have had trouble with this before, so it might be useful to add more details about the different mappings to the setup instructions found in the CommandAPI's documentation here (https://commandapi.jorel.dev/9.5.2/setup_shading.html#shading-with-maven).
Thank you very much for the fast response - the missing entry in the manifest was indeed the issue. I think adding a short notice regarding this topic in the docs wouldn't hurt (Even though it's technically not CommandAPI related).
Because this is solved, I would close this issue.
CommandAPI version
9.5.3
Minecraft version
1.20.6
Are you shading the CommandAPI?
Yes
What I did
onLoad():
onEnable():
What actually happened
I immediately receive the following error in the load lifecycle:
Obviously an error on enabling the plugin occurs afterwards;
java.lang.IllegalStateException: Tried to access CommandAPIHandler instance, but it was null! Are you using CommandAPI features before calling CommandAPI#onLoad?
What should have happened
No error on load
Server logs and CommandAPI config
No response
Other
Probably has something to do with remapping/no relocation of the NMS classes in PaperMC 1.20.6+