Skip to content

Add command permissions support for brigadier commands#287

Open
Lyfts wants to merge 7 commits into
masterfrom
brigadier-cmd-permission
Open

Add command permissions support for brigadier commands#287
Lyfts wants to merge 7 commits into
masterfrom
brigadier-cmd-permission

Conversation

@Lyfts
Copy link
Copy Markdown
Member

@Lyfts Lyfts commented May 9, 2026

Currently the command permission system has no way of controlling Brigadier commands which is quite a big problem as more mods are beginning to use them.

This makes those commands work with the permission system just like regular minecraft commands.

Has been tested with each of the gtnhlib team commands along with its various sub-commands and all seem to work as expected.

@Lyfts Lyfts marked this pull request as ready for review May 10, 2026 17:19
@Lyfts Lyfts requested a review from a team May 10, 2026 17:19
@Nikolay-Sitnikov
Copy link
Copy Markdown
Contributor

Why do we control commands like this rather than mixing into ICommandSender#canCommandSenderUseCommand(int permissionLevel, String command)?

int permissionLevel means that the same command can provide multiple levels of commands by checking with different numbers. (For example, /gtnhteam rename would check 0, "gtnhteam", while /gtnhteam_admin rename would check 2, "gtnhteam_admin")

String command means that we could even provide extra features by putting in longer strings into the second parameter. All vanilla commands (including CommandBase, which most mods use for their custom commands) pass just the command name for the second parameter, but we could make subcommands pass longer strings (such as checking 0, "gtnhteam rename" for /gtnhteam rename.) It would be entirely back-compatible with all existing commands since vanilla would never pass a space inside the second parameter.

Or is the issue that some modded commands don't check canCommandSenderUseCommand at all?

@Lyfts
Copy link
Copy Markdown
Member Author

Lyfts commented May 19, 2026

Commands won't necessarily use canCommandSenderUseCommand.
They can define who has access in their own weird ways, and some modded commands do exactly that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants