File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
src/main/java/me/croabeast/command Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -78,26 +78,20 @@ public class SubCommand implements BaseCommand {
7878 * </p>
7979 *
8080 * @param parent the parent command (must not be {@code null}).
81- * @param name the sub-command name, optionally including aliases separated by a semicolon.
81+ * @param aliases the sub-command name, optionally including aliases separated by a semicolon.
8282 * @throws NullPointerException if the parent is {@code null} or if the name is blank.
8383 */
84- public SubCommand (Command parent , String name ) {
84+ public SubCommand (Command parent , String name , String ... aliases ) {
8585 this .parent = Objects .requireNonNull (parent , "Parent cannot be null" );
8686
8787 if (StringUtils .isBlank (name ))
8888 throw new NullPointerException ("Name is empty" );
89-
89+
9090 // Split the provided name string by semicolons to extract primary name and aliases.
91- List <String > list = new ArrayList <>( Arrays .asList (name . split ( ";" )) );
92- this .name = list . get ( 0 ) ;
91+ List <String > list = Arrays .asList (aliases );
92+ this .name = name ;
9393 this .permission = parent .getPermission () + '.' + this .name ;
94-
95- // Add any aliases if provided.
96- if (list .size () > 1 ) {
97- for (int i = 1 ; i < list .size (); i ++) {
98- aliases .add (list .get (i ));
99- }
100- }
94+ this .aliases .addAll (list );
10195 }
10296
10397 /**
You can’t perform that action at this time.
0 commit comments