@@ -162,8 +162,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.comm
162
162
for (Map .Entry <Command , Map .Entry <Method , Object >> entry : commands .entrySet ()) {
163
163
Command command = entry .getKey ();
164
164
String [] splitted = command .name ().split ("\\ ." );
165
- String allArgs = String .join ("." , Arrays .copyOfRange (args , 0 , splitted .length - 1 ));
166
- String cmdName = (command .name ().contains ("." ) ? splitted [0 ] : cmd .getName ()) + "." + allArgs ;
165
+ String allArgs = args . length == 0 ? "" : "." + String .join ("." , Arrays .copyOfRange (args , 0 , splitted .length - 1 ));
166
+ String cmdName = (command .name ().contains ("." ) ? splitted [0 ] : cmd .getName ()) + allArgs ;
167
167
168
168
if (command .name ().equalsIgnoreCase (cmdName ) || Stream .of (command .aliases ()).anyMatch (cmdName ::equalsIgnoreCase )) {
169
169
if (!sender .hasPermission (command .permission ())) {
@@ -197,21 +197,22 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.comm
197
197
if (args .length >= command .min () + splitted .length - 1 && newArgs .length <= (command .max () == -1 ? newArgs .length + 1 : command .max ())) {
198
198
try {
199
199
entry .getValue ().getKey ().invoke (entry .getValue ().getValue (), new CommandArguments (sender , cmd , label , newArgs ));
200
+ return true ;
200
201
} catch (IllegalAccessException | InvocationTargetException e ) {
201
202
e .printStackTrace ();
203
+ return true ;
202
204
}
203
205
} else {
204
206
sender .sendMessage (SHORT_OR_LONG_ARG_SIZE );
207
+ return true ;
205
208
}
206
-
207
- return true ;
208
209
}
209
210
}
210
211
211
- if (anyMatchConsumer != null ) {
212
- anyMatchConsumer .accept (new CommandArguments (sender , cmd , label , args ));
213
- return true ;
214
- }
212
+ if (anyMatchConsumer != null ) {
213
+ anyMatchConsumer .accept (new CommandArguments (sender , cmd , label , args ));
214
+ return true ;
215
+ }
215
216
216
217
return false ;
217
218
}
0 commit comments