Java can't find CommodoreFileReader (ClassNotFoundException)
So I'm trying to implement the api with my current paper Plugin, but I get this error, no matter what I try.
java.lang.NoClassDefFoundError: me/lucko/commodore/file/CommodoreFileReader at sh.plunzi.plunzichatplugin.PlunziChatPlugin.registerCompletions(PlunziChatPlugin.java:120) ~[PlunziChatPlugin-6.9.jar:?] at sh.plunzi.plunzichatplugin.PlunziChatPlugin.register(PlunziChatPlugin.java:113) ~[PlunziChatPlugin-6.9-420.jar:?] at sh.plunzi.plunzichatplugin.PlunziChatPlugin.onEnable(PlunziChatPlugin.java:52) ~[PlunziChatPlugin-6.9.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:501) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:562) ~[paper-1.18.1.jar:git-Paper-216] at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:476) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:736) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:503) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:313) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1211) ~[paper-1.18.1.jar:git-Paper-216] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-216] at java.lang.Thread.run(Thread.java:833) ~[?:?] Caused by: java.lang.ClassNotFoundException: me.lucko.commodore.file.CommodoreFileReader at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] ... 14 more
I have already tried packaging it as a shaded and a fat jar, neither of which did anything. IntelliJ can find the class though and doesn't give me any errors either. So idk if I produce a bug in the api or am just not capable of using the api correctly
My code looks somewhat like this:
(Main class)
@Override
public void onEnable() {
PluginCommand command = getCommand("color");
command.setExecutor(new DebuggingCommand());
if (CommodoreProvider.isSupported()) {
// get a commodore instance
Commodore commodore = CommodoreProvider.getCommodore(this);
try {
registerCompletions(commodore, command);
} catch (IOException e) {
Debug.throwException(e);
}
}
}
...
private void registerCompletions(Commodore commodore, PluginCommand command) throws IOException {
LiteralCommandNode<?> colorCommand = me.lucko.commodore.file.CommodoreFileReader.INSTANCE.parse(getResource("color.commodore"));
commodore.register(command, colorCommand);
commodore.register(command, LiteralArgumentBuilder.literal("color")
.then(RequiredArgumentBuilder.argument("color-one", StringArgumentType.word()))
.then(RequiredArgumentBuilder.argument("color-two", StringArgumentType.word()))
.then(RequiredArgumentBuilder.argument("message", StringArgumentType.greedyString()))
);
}
...
(color.commodore file)
color {
color_one brigadier:string single_word {
color_two brigadier:string single_word {
message brigadier:string greedy_phrase;
}
}
}