I've been trying to register a command for a few hours now. I entered this in the paper-plugin.yml (I also tried it with a plugin.yml):
and in the onEnable() method this:
When I start the server I get the error
"Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "de.uweb95.testplugin.Testplugin.getCommand(String)" is null"
I've also tried using the onCommand() method directly in the main class (that's how I did it earlier with a working 1.13 plugin), but I just get "Unknown command. Type "/help" for help."
It feels like the command part of the paper-plugin.yml is being ignored but i just don't know what to do next...
YAML:
commands:
xyz:
description: "desc"
usage: "/xyz"
and in the onEnable() method this:
Java:
getCommand("xyz").setExecutor(new XYZCommandExecutor());
When I start the server I get the error
"Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "de.uweb95.testplugin.Testplugin.getCommand(String)" is null"
I've also tried using the onCommand() method directly in the main class (that's how I did it earlier with a working 1.13 plugin), but I just get "Unknown command. Type "/help" for help."
Java:
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (command.getLabel().equalsIgnoreCase("xyz")) {
getLogger().info("test");
}
return true;
}
It feels like the command part of the paper-plugin.yml is being ignored but i just don't know what to do next...
- Version Output
- This server is running Paper version git-Paper-31 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: a226f44)