Commit 61f16fe2 authored by Setako's avatar Setako

[Fix] Fix missing i18n command and remove debug message

parent 09ef8a53
......@@ -10,11 +10,16 @@ import dev.reactant.reactant.core.component.lifecycle.LifeCycleHook
import dev.reactant.reactant.core.dependency.ProviderManager
import dev.reactant.reactant.extra.command.PicocliCommandService
import dev.reactant.reactant.extra.file.FileIOUploadService
import dev.reactant.reactant.extra.i18n.I18nService
import dev.reactant.reactant.extra.i18n.commands.I18nCommand
import dev.reactant.reactant.extra.i18n.commands.I18nGenerateTableCommand
import dev.reactant.reactant.extra.i18n.commands.I18nListTableCommand
import dev.reactant.reactant.extra.profiler.ReactantProfilerService
import dev.reactant.reactant.extra.profiler.commands.ProfilerCommand
import dev.reactant.reactant.extra.profiler.commands.ProfilerListCommand
import dev.reactant.reactant.extra.profiler.commands.ProfilerStartCommand
import dev.reactant.reactant.extra.profiler.commands.ProfilerStopCommand
import dev.reactant.reactant.service.spec.config.ConfigService
import dev.reactant.reactant.service.spec.parser.JsonParserService
import dev.reactant.reactant.service.spec.server.SchedulerService
......@@ -26,7 +31,9 @@ internal class ReactantCommandRegister(
private val profilerService: ReactantProfilerService,
private val schedulerService: SchedulerService,
private val fileIOUploadService: FileIOUploadService,
private val jsonParserService: JsonParserService
private val jsonParserService: JsonParserService,
private val i18nService: I18nService,
private val configService: ConfigService
) : LifeCycleHook {
override fun onEnable() {
......@@ -48,6 +55,11 @@ internal class ReactantCommandRegister(
command({ ProfilerStartCommand(profilerService, fileIOUploadService, jsonParserService) })
command({ ProfilerStopCommand(profilerService) })
}
command(::I18nCommand) {
command({ I18nListTableCommand(i18nService) })
command({ I18nGenerateTableCommand(i18nService, jsonParserService, configService) })
}
}
}
}
......
......@@ -16,7 +16,6 @@ import org.bukkit.command.CommandSender
import org.bukkit.command.SimpleCommandMap
import picocli.CommandLine.Model
import kotlin.reflect.KType
import kotlin.system.measureNanoTime
@Component
class PicocliCommandServiceProvider(
......@@ -80,7 +79,7 @@ class PicocliCommandServiceProvider(
commandSpec.aliases().toList()) {
override fun execute(sender: CommandSender, commandLabel: String, args: Array<out String>): Boolean {
val writer = CommandSenderWriter(sender)
var grouppedArgs: List<String> = argsGroupingRegex.findAll(args.joinToString(" ")).map { it.value }.toList()
val grouppedArgs: List<String> = argsGroupingRegex.findAll(args.joinToString(" ")).map { it.value }.toList()
profilerDataProvider.measure(grouppedArgs, requester) {
commandTreeMap[name]!!.getCommandLine(sender, writer)
......@@ -91,12 +90,7 @@ class PicocliCommandServiceProvider(
}
ReactantCore.logger.error("Error occurred while executing the command \"$name ${args.joinToString(" ")}\"", ex);
1
}
.let {
measureNanoTime {
it.execute(*(grouppedArgs.toTypedArray()))
}.let { ReactantCore.logger.info("s2:${it / 1000000}") }
}
}.execute(*(grouppedArgs.toTypedArray()))
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment