@@ -95,7 +95,7 @@ public SuggestionProvider getProvider(CommandParameter parameter) {
95
95
@ Override public List <String > complete (@ NotNull CommandActor actor , @ NotNull ArgumentStack arguments ) {
96
96
CommandPath path = CommandPath .get (arguments .subList (0 , arguments .size () - 1 ));
97
97
int originalSize = arguments .size ();
98
- ExecutableCommand command = searchForCommand (path );
98
+ ExecutableCommand command = searchForCommand (path , actor );
99
99
if (command != null ) {
100
100
command .getPath ().forEach (c -> arguments .removeFirst ());
101
101
return getCompletions (actor , arguments , command );
@@ -112,14 +112,14 @@ public SuggestionProvider getProvider(CommandParameter parameter) {
112
112
return complete (actor , ArgumentStack .fromString (buffer ));
113
113
}
114
114
115
- private ExecutableCommand searchForCommand (CommandPath path ) {
115
+ private ExecutableCommand searchForCommand (CommandPath path , CommandActor actor ) {
116
116
ExecutableCommand found = handler .getCommand (path );
117
- if (found != null && !found .isSecret ()) return found ;
117
+ if (found != null && !found .isSecret () && found . getPermission (). canExecute ( actor ) ) return found ;
118
118
MutableCommandPath mpath = MutableCommandPath .empty ();
119
119
for (String p : path ) {
120
120
mpath .add (p );
121
121
found = handler .getCommand (mpath );
122
- if (found != null && !found .isSecret ())
122
+ if (found != null && !found .isSecret () && found . getPermission (). canExecute ( actor ) )
123
123
return found ;
124
124
}
125
125
return null ;
@@ -190,7 +190,7 @@ private List<String> getCompletions(CommandActor actor, @Unmodifiable ArgumentSt
190
190
}
191
191
if (originalSize - category .getPath ().size () == 1 ) {
192
192
category .getCommands ().values ().forEach (c -> {
193
- if (!c .isSecret ()) suggestions .add (c .getName ());
193
+ if (!c .isSecret () && c . getPermission (). canExecute ( actor ) ) suggestions .add (c .getName ());
194
194
});
195
195
category .getCategories ().values ().forEach (c -> suggestions .add (c .getName ()));
196
196
}
0 commit comments