Skip to content

Commit ee5907b

Browse files
committed
Propagate namespace when registering subcommands
1 parent e13eb6d commit ee5907b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

commandapi-core/src/main/java/dev/jorel/commandapi/AbstractCommandAPICommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Impl setConverted(boolean isConverted) {
215215
// shouldn't be accessing/depending on any of the contents of the current class instance)
216216
@SuppressWarnings({ "unchecked", "rawtypes" })
217217
private static <Impl extends AbstractCommandAPICommand<Impl, Argument, CommandSender>, Argument extends AbstractArgument<?, ?, Argument, CommandSender>, CommandSender>
218-
void flatten(Impl rootCommand, List<Argument> prevArguments, Impl subcommand) {
218+
void flatten(Impl rootCommand, List<Argument> prevArguments, Impl subcommand, String namespace) {
219219
// Get the list of literals represented by the current subcommand. This
220220
// includes the subcommand's name and any aliases for this subcommand
221221
String[] literals = new String[subcommand.meta.aliases.length + 1];
@@ -243,11 +243,11 @@ void flatten(Impl rootCommand, List<Argument> prevArguments, Impl subcommand) {
243243
rootCommand.withArguments(subcommand.arguments);
244244
rootCommand.executor = subcommand.executor;
245245
rootCommand.subcommands = new ArrayList<>();
246-
rootCommand.register();
246+
rootCommand.register(namespace);
247247
}
248248

249249
for (Impl subsubcommand : subcommand.getSubcommands()) {
250-
flatten(rootCommand, new ArrayList<>(prevArguments), subsubcommand);
250+
flatten(rootCommand, new ArrayList<>(prevArguments), subsubcommand, namespace);
251251
}
252252
}
253253

@@ -310,7 +310,7 @@ public void register(String namespace) {
310310

311311
// Convert subcommands into multiliteral arguments
312312
for (Impl subcommand : this.subcommands) {
313-
flatten(this.copy(), new ArrayList<>(), subcommand);
313+
flatten(this.copy(), new ArrayList<>(), subcommand, namespace);
314314
}
315315
}
316316

0 commit comments

Comments
 (0)