diff --git a/.github/README.md b/.github/README.md index ec5875e..a1c3bc6 100644 --- a/.github/README.md +++ b/.github/README.md @@ -39,7 +39,7 @@ To add this project as a dependency to your project, add the following to your p com.github.Despical CommandFramework - 1.1.7 + 1.1.8 compile ``` @@ -52,7 +52,7 @@ repositories { ``` ``` dependencies { - compileOnly group: "com.github.Despical", name: "CommandFramework", version: "1.1.7"; + compileOnly group: "com.github.Despical", name: "CommandFramework", version: "1.1.8"; } ``` diff --git a/pom.xml b/pom.xml index f67856b..d063eac 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 me.despical command-framework - 1.1.7 + 1.1.8 8 @@ -48,7 +48,7 @@ com.github.Despical Commons - 1.6.0 + 1.6.1 diff --git a/src/main/java/me/despical/commandframework/CommandFramework.java b/src/main/java/me/despical/commandframework/CommandFramework.java index ed8d7b0..c50b64e 100644 --- a/src/main/java/me/despical/commandframework/CommandFramework.java +++ b/src/main/java/me/despical/commandframework/CommandFramework.java @@ -337,6 +337,10 @@ public List onTabComplete(@NotNull CommandSender sender, @NotNull org.bu if (entry == null) return null; + final String permission = entry.getKey().permission(); + + if (!permission.isEmpty() && !sender.hasPermission(permission)) return null; + try { final Object instance = entry.getValue().getKey().invoke(entry.getValue().getValue(), new CommandArguments(sender, cmd, label, args)); diff --git a/src/main/java/me/despical/commandframework/Completer.java b/src/main/java/me/despical/commandframework/Completer.java index 33cf275..165f78b 100644 --- a/src/main/java/me/despical/commandframework/Completer.java +++ b/src/main/java/me/despical/commandframework/Completer.java @@ -23,7 +23,7 @@ import java.lang.annotation.Target; /** - * An utility class in framework to create argument completions + * A utility class in framework to create argument completions * for commands. * * @author Despical @@ -42,6 +42,13 @@ */ String name(); + /** + * The permission that sender must have to receive tab complete. + * + * @return name of the permission + */ + String permission() default ""; + /** * An alternative name list of command. Check {@link #name()} * to understand how command names work.