Question File/compiling bug or dev bug?

NaNasuuAkiaa

New member
Aug 28, 2022
4
0
1
So yeah. I have been talking with some people on the PaperMC discord server and asking for help about a problem I'm having. So, when I start the server, the plugin starts up and even the little log comes up but then it crashes with this log:
Code:
[04:53:01 ERROR]: Error occurred while enabling Commonchaterrors v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "es.nanasuuakiaa.commonchaterrors.Commonchaterrors.getCommand(String)" is null
        at es.nanasuuakiaa.commonchaterrors.Commonchaterrors.onEnable(Commonchaterrors.java:12) ~[commonchaterrors-1.0-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:541) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:560) ~[paper-1.18.2.jar:git-Paper-387]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:474) ~[paper-1.18.2.jar:git-Paper-387]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:665) ~[paper-1.18.2.jar:git-Paper-387]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:432) ~[paper-1.18.2.jar:git-Paper-387]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:316) ~[paper-1.18.2.jar:git-Paper-387]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1164) ~[paper-1.18.2.jar:git-Paper-387]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.18.2.jar:git-Paper-387]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

I've done a bit of research but the only things I did find were related to the plugin.yml and mine was perfect at least in the coding part. Then I tried compiling with maven directly instead of with intellij and then drag the file into the plugins folder but nothing changed. I used the clean task multiple times then rebuilt and nothing. I really don't know what to try next. Any ideas? Anything is welcome
 

NaNasuuAkiaa

New member
Aug 28, 2022
4
0
1
What's happening at line 12 in Commonchaterrors.java? Have you got a copy of what you have in your onEnable method?
Java:
    @Override
    public void onEnable() {
        // Plugin startup logic
        getLogger().info("Hello everyone :)");
        getCommand("magia").setExecutor(new Magicdust()); //line 12 is this one
    }
 

NaNasuuAkiaa

New member
Aug 28, 2022
4
0
1
Could you show your plugin.yml?
Sure;
YAML:
name: Commonchaterrors
version: '${project.version}'
main: es.nanasuuakiaa.commonchaterrors.Commonchaterrors
api-version: 1.18
commands:
  Magicdust:
    description: makes magic happen
    usage: /<command>
Compiles changing project version to 1.0, but same output
 

NaNasuuAkiaa

New member
Aug 28, 2022
4
0
1
Update with final error and solution: I was trying to match the file name with the name on the plugin.yml, instead i matched the plugin.yml name with the name i was loading the command with on the onEnable, that worked fine :)