Skip to content

Add permissions for "reset" and sequence arguments in "/random". - #14128

Open
Mickey42302 wants to merge 3 commits into
PaperMC:mainfrom
Mickey42302:random
Open

Add permissions for "reset" and sequence arguments in "/random".#14128
Mickey42302 wants to merge 3 commits into
PaperMC:mainfrom
Mickey42302:random

Conversation

@Mickey42302

Copy link
Copy Markdown
Contributor

Hello,

I would like to suggest implementing some additional permission nodes for "/random".

Currently, the "reset" subcommand and sequence arguments only work if a player has operator privileges. This is the case even if a regular player has the "minecraft.command.random" permission.

This addition would allow server owners to grant the ability to use sequences and the "reset" subcommand without needing to grant operator privileges.

For the "reset" subcommand, the permission node is "minecraft.command.random.reset". For sequence arguments, the permission node is "minecraft.command.random.sequence".

@Mickey42302
Mickey42302 requested a review from a team as a code owner July 30, 2026 16:02
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Jul 30, 2026
.then(
Commands.literal("reset")
- .requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS))
+ .requires(stack -> stack.getSender().isOp() || stack.getSender().hasPermission("minecraft.command.random.reset")) // Paper - Add permission node for reset

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we falling to isOp here?
.requires(Commands.<CommandSourceStack>hasPermission(Commands.LEVEL_GAMEMASTERS).or(stack -> stack.getBukkitSender().hasPermission("minecraft.commands.random.reset"))) // Paper - specific permissions for sub command would work.

Commands.argument("sequence", IdentifierArgument.id())
.suggests(RandomCommand::suggestRandomSequence)
- .requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS))
+ .requires(stack -> stack.getSender().isOp() || stack.getSender().hasPermission("minecraft.command.random.sequence")) // Paper - Add permission node for sequence

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one permission covers both the /random value and /random roll command.
Shouldn't this be split up?

@github-project-automation github-project-automation Bot moved this from Awaiting review to Changes required in Paper PR Queue Aug 2, 2026
@Mickey42302

Copy link
Copy Markdown
Contributor Author

The code is updated now.

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

Labels

None yet

Projects

Status: Changes required

Development

Successfully merging this pull request may close these issues.

2 participants