File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
common/src/main/kotlin/com/lambda Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -3,24 +3,26 @@ package com.lambda.command
33import com.lambda.config.Configurable
44import com.lambda.config.configurations.LambdaConfig
55import com.lambda.core.Loadable
6+ import com.lambda.module.Module
7+ import com.lambda.module.ModuleRegistry
8+ import com.lambda.module.ModuleRegistry.modules
69import org.reflections.Reflections
710import org.reflections.scanners.Scanners
811import org.reflections.util.ConfigurationBuilder
912
13+ /* *
14+ * The [CommandRegistry] object is responsible for managing all [LambdaCommand] instances in the system.
15+ */
1016object CommandRegistry : Configurable(LambdaConfig ), Loadable {
1117 override val name = " command"
1218
1319 val prefix by setting(" prefix" , ' ;' )
1420 val commands = mutableSetOf<LambdaCommand >()
1521
16- private val paths = mutableSetOf (" com.lambda.command.commands" )
17-
18- fun injectPath (path : String ) = paths.add(path)
19-
2022 override fun load (): String {
2123 Reflections (
2224 ConfigurationBuilder ()
23- .forPackages( * paths.toTypedArray() )
25+ .forPackage( " com.lambda.command.commands " )
2426 .setScanners(Scanners .SubTypes )
2527 ).getSubTypesOf(LambdaCommand ::class .java).forEach { commandClass ->
2628 commandClass.declaredFields.find {
Original file line number Diff line number Diff line change @@ -8,23 +8,17 @@ import org.reflections.util.ConfigurationBuilder
88
99/* *
1010 * The [ModuleRegistry] object is responsible for managing all [Module] instances in the system.
11- *
12- * @property modules A set of all [Module] instances in the system.
1311 */
1412object ModuleRegistry : Loadable {
1513 val modules = mutableSetOf<Module >()
1614
1715 val moduleNames: Set <String >
1816 get() = modules.map { it.name }.toSet()
1917
20- private val paths = mutableSetOf (" com.lambda.module.modules" )
21-
22- fun injectPath (path : String ) = paths.add(path)
23-
2418 override fun load (): String {
2519 Reflections (
2620 ConfigurationBuilder ()
27- .forPackages(* paths.toTypedArray() )
21+ .forPackages(" com.lambda.module.modules " )
2822 .addScanners(Scanners .SubTypes )
2923 ).getSubTypesOf(Module ::class .java).forEach { moduleClass ->
3024 moduleClass.declaredFields.find {
You can’t perform that action at this time.
0 commit comments