Skip to content

Commit

Permalink
GH-81 Check permissions in tab-completion (Resolve #81)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed Sep 8, 2024
1 parent ef62b67 commit f4e8411
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Add these declarations to your `pom.xml`.
<dependency>
<groupId>net.dzikoysk</groupId>
<artifactId>funnycommands</artifactId>
<version>0.7.0</version>
<version>0.7.1</version>
</dependency>
</dependencies>
```
Expand All @@ -37,7 +37,7 @@ repositories {
}
dependencies {
implementation "net.dzikoysk:funnycommands:0.7.0"
implementation "net.dzikoysk:funnycommands:0.7.1"
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ allprojects {
apply(plugin = "maven-publish")

group = "net.dzikoysk"
version = "0.7.0"
version = "0.7.1"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ public List<String> tabComplete(CommandSender sender, String alias, String[] arg

CommandInfo commandInfo = context.getCommandStructure().getMetadata().getCommandInfo();

// skip completion for unauthorized commands
if (!commandInfo.getPermission().isEmpty() && !sender.hasPermission(commandInfo.getPermission())) {
return Collections.emptyList();
}

// skip undefined completions
if (commandInfo.getCompletes().isEmpty()) {
return Collections.emptyList();
Expand Down
2 changes: 1 addition & 1 deletion funnycommands/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: FunnyCommands
main: net.dzikoysk.funnycommands.FunnyCommandsPlugin
version: 0.7.0
version: 0.7.1
author: dzikoysk

0 comments on commit f4e8411

Please sign in to comment.