Custom commands registered via the Script API fail to run for non-operator players if the command includes a PlayerSelector or EntitySelector parameter. The command registration uses permissionLevel: Any, but if the command is ran by a non-op, you’ll get this error:
<Insufficient permission for selector expansion>
This appears to happen before the script callback is invoked, meaning the custom command execution is blocked.
Steps to Reproduce
Create a behaviour pack with Script API enabled.
Register a custom command that has a
PlayerSelectororEntitySelectormandatory parameter.Load a world with the behaviour pack enabled.
Run the command as a non-op, either by de-opping yourself or joining on an alternative account without op permissions.
I included a behaviour pack with 2 custom commands, /cz:test_player <player> and /cz:test_entity <entity> which both produce the bug.
Expected Result
Because the custom command is registered with permissionLevel: Any, non-operator players should be able to execute it successfully, and the script callback should run.
Actual Result
For non-operators, the command fails immediately with:<Insufficient permission for selector expansion>
Even if you use selector expansions or not, the callback is still not invoked, and the command cannot be used.
Hi!
Thank you for your report!
We're already tracking this issue at MCPE-230568 , so I will resolve and link this ticket as a Duplicate.
I suggest also to browse through the main issue for potential fixes.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki