mojira.dev
MCPE-234764

Custom Commands with PlayerSelector or EntitySelector parameters fail for non-operators.

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

  1. Create a behaviour pack with Script API enabled.

  2. Register a custom command that has a PlayerSelector or EntitySelector mandatory parameter.

  3. Load a world with the behaviour pack enabled.

  4. 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.

Linked issues

Attachments

Comments 1

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

CZ

(Unassigned)

Unconfirmed

Multiple

Windows 11

1.21.131 Hotfix, 1.21.132 Hotfix

Retrieved