Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Player Roles Wiki › Guides › How to Restrict Which Commands a Role Can Use

How to Restrict Which Commands a Role Can Use

Understand the commands override

In roles.json, each role can contain a commands section. Every entry there is a regular expression pattern plus a strategy telling the mod what to do when a player's command matches that pattern. This is how you allow or block specific commands per role.

Write the pattern and strategy

Add an entry where the key is a regex matching the command you care about — for example a pattern that matches a command name at the start of the input. Pair it with the strategy you want: one that permits the command, or one that denies it. Keep patterns as specific as possible so you don't accidentally match unrelated commands that share a prefix.

Test and iterate

Reload the config, then have a player with that role try the command. If it's still allowed when it shouldn't be, your pattern is probably too loose or another role is granting it. Remember that everyone applies to all players, so if everyone allows a command, a role must explicitly override it to block it. Adjust the regex, reload, and retest until the behavior matches what you intended.