Skip to content

Commit

Permalink
Only show commands that player can execute (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
vyPal authored Feb 14, 2025
1 parent 9c32499 commit d6a3506
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pumpkin/src/command/commands/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ impl CommandExecutor for BaseHelpExecutor {
Command::Tree(tree) => Some(tree),
Command::Alias(_) => None,
})
.filter(|tree| {
dispatcher
.permissions
.get(&tree.names[0])
.map_or(true, |perm| sender.has_permission_lvl(*perm))
})
.collect();

commands.sort_by(|a, b| a.names[0].cmp(&b.names[0]));
Expand Down

0 comments on commit d6a3506

Please sign in to comment.