@@ -53,7 +53,7 @@ public static void parse(@NotNull BaseCommandHandler handler, @NotNull Class<?>
53
53
int id = COMMAND_ID .getAndIncrement ();
54
54
boolean isDefault = reader .contains (Default .class );
55
55
paths .forEach (path -> {
56
- for (BaseCommandCategory category : getCategories (isDefault , path )) {
56
+ for (BaseCommandCategory category : getCategories (handler , isDefault , path )) {
57
57
categories .putIfAbsent (category .path , category );
58
58
}
59
59
CommandExecutable executable = new CommandExecutable ();
@@ -147,12 +147,13 @@ private static Type getInsideGeneric(Type genericType) {
147
147
}
148
148
}
149
149
150
- private static Set <BaseCommandCategory > getCategories (boolean respectDefault , @ NotNull CommandPath path ) {
150
+ private static Set <BaseCommandCategory > getCategories (CommandHandler handler , boolean respectDefault , @ NotNull CommandPath path ) {
151
151
if (path .size () == 1 && !respectDefault ) return Collections .emptySet ();
152
152
String parent = path .getParent ();
153
153
Set <BaseCommandCategory > categories = new HashSet <>();
154
154
155
155
BaseCommandCategory root = new BaseCommandCategory ();
156
+ root .handler = handler ;
156
157
root .path = CommandPath .get (parent );
157
158
root .name = parent ;
158
159
categories .add (root );
@@ -163,6 +164,7 @@ private static Set<BaseCommandCategory> getCategories(boolean respectDefault, @N
163
164
for (String subcommand : path .getSubcommandPath ()) {
164
165
pathList .add (subcommand );
165
166
BaseCommandCategory cat = new BaseCommandCategory ();
167
+ cat .handler = handler ;
166
168
cat .path = CommandPath .get (pathList );
167
169
cat .name = cat .path .getName ();
168
170
categories .add (cat );
0 commit comments