Fix command reflection

This commit is contained in:
Him188 2020-10-30 11:35:26 +08:00
parent 80e869e8c9
commit 71c744c429

View File

@ -230,10 +230,10 @@ internal class CommandReflector(
.onEach { it.checkNames() } .onEach { it.checkNames() }
.flatMap { function -> .flatMap { function ->
val names = annotationResolver.getSubCommandNames(command, function) val names = annotationResolver.getSubCommandNames(command, function)
if (names.isEmpty()) sequenceOf(createMapEntry(function, null)) if (names.isEmpty()) sequenceOf(createMapEntry(null, function))
else names.associateBy { function }.asSequence() else names.associateWith { function }.asSequence()
} }
.map { (function, name) -> .map { (name, function) ->
val functionNameAsValueParameter = val functionNameAsValueParameter =
name?.split(' ')?.mapIndexed { index, s -> createStringConstantParameter(index, s) } name?.split(' ')?.mapIndexed { index, s -> createStringConstantParameter(index, s) }