@@ -340,14 +340,20 @@ private String[] placeholders(@Nullable final String[] messages, @Nonnull final
340340 if (messages == null ) return new String []{"" };
341341 String permission = subcommand != null ? subcommand .getPermission () : null ;
342342 if (permission == null ) permission = "" ;
343- String [] string = new String [ messages . length ] ;
343+ List < String > resultList = new ArrayList <>() ;
344344
345- for (int i = 0 ; i < messages .length ; i ++) {
346- final String message = messages [i ].replace ("{label}" , "/" + commandLabel + (subcommand != null ? " " + this .formatSet (subcommand .getCommandLabels ()) : "" )).replace ("{perm}" , permission );
347- string [i ] = this .translateColors (message );
348- }
345+ for (String message : messages ) {
346+ if (message != null ) {
347+ final String messageFormated = message
348+ .replace ("{label}" , "/" + commandLabel + (subcommand != null ? " " + this .formatSet (subcommand .getCommandLabels ()) : "" ))
349+ .replace ("{perm}" , permission );
349350
350- return string ;
351+ if (!messageFormated .isEmpty ()) {
352+ resultList .add (this .translateColors (messageFormated ));
353+ }
354+ }
355+ }
356+ return resultList .toArray (new String [0 ]);
351357 }
352358
353359 private String [] placeholders (@ Nullable final String message , @ Nonnull final String commandLabel , @ Nullable final CommandProperty subcommand ) {
@@ -421,7 +427,9 @@ private boolean sendDescriptions(CommandSender sender, String commandLabel, Stri
421427 private void sendUsageMessage (@ Nonnull final CommandSender sender , @ Nonnull final String commandLabel , @ Nonnull final CommandProperty executor , final boolean executeCommand ) {
422428 String [] message = executor .getUsageMessage ();
423429 if (message .length > 0 && !executeCommand ) {
424- sender .sendMessage (placeholders (message , commandLabel , executor ));
430+ String [] placeholders = placeholders (message , commandLabel , executor );
431+ if (placeholders .length > 0 )
432+ sender .sendMessage (placeholders );
425433 }
426434 }
427435
0 commit comments