Description
CommandAPI version
8.7.5
Minecraft version
1.19.3
Are you shading the CommandAPI?
No
What I did
I was editing the commands.yml file of my paper server to disable some commands.
Like this:
command-block-overrides: []
ignore-vanilla-permissions: false
aliases:
help:
- []
'?':
- []
What actually happened
By modifying commands.yml the commands 'help' and '?' have been removed. However, this caused the plugin to throw a NullPointerException when trying to fix command permissions, after my change.
What should have happened
I expected CommandAPI to simply ignore these now removed commands.
Server logs and CommandAPI config
I use the default config.yml for CommandAPI.
Error trace:
[09:35:17 INFO]: Running delayed init tasks
[09:35:17 WARN]: [CommandAPI] Task #3 for CommandAPI v8.7.5 generated an exception
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.Command.setPermission(String)" because the return value of "org.bukkit.command.CommandMap.getCommand(String)" is null
at dev.jorel.commandapi.CommandAPIHandler.fixPermissions(CommandAPIHandler.java:529) ~[CommandAPI-8.7.5.jar:?]
at dev.jorel.commandapi.CommandAPI.lambda$onEnable$0(CommandAPI.java:199) ~[CommandAPI-8.7.5.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.3.jar:git-Paper-404]
at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.3.jar:git-Paper-404]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1114) ~[paper-1.19.3.jar:git-Paper-404]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-404]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[09:35:17 INFO]: Done (4.501s)! For help, type "hel
5A0F
p"
Other
The best way I found to fix the bug was to re-add a value to the disabled commands. Like this:
command-block-overrides: []
ignore-vanilla-permissions: false
aliases:
help:
- minecraft:help
'?':
- minecraft:help
However, doing this does not disable the commands, it just creates aliases. It would be cool if CommandAPI ignored null commands, or even had an option to disable the permission fix, that creates problems sometimes.
Thank you for reading.