Skip to content

Commit

Permalink
fixed constructors with dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
makeevrserg committed Feb 26, 2023
1 parent 72f6ebc commit cafb4f1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.astrainteractive.astratemplate.domain.Repository
import ru.astrainteractive.astralibs.commands.registerCommand
import ru.astrainteractive.astralibs.di.Dependency
import ru.astrainteractive.astralibs.di.getValue
Expand All @@ -10,6 +11,7 @@ import ru.astrainteractive.astratemplate.commands.randomRickAndMortyCharacter
import ru.astrainteractive.astratemplate.commands.reload
import ru.astrainteractive.astratemplate.commands.tabCompleter
import ru.astrainteractive.astratemplate.commands.tempGUI
import ru.astrainteractive.astratemplate.modules.ServiceLocator
import ru.astrainteractive.astratemplate.plugin.Translation

/**
Expand All @@ -18,7 +20,9 @@ import ru.astrainteractive.astratemplate.plugin.Translation
* @see Reload
*/
class CommandManager(
translationModule: Dependency<Translation>
translationModule: Dependency<Translation>,
repositoryModule: Dependency<Repository>,
guiFactories: ServiceLocator.Guis
) {
private val translation by translationModule

Expand All @@ -33,11 +37,21 @@ class CommandManager(
tabCompleter()
addCommandCompleter()
addCommand()
damageCompleter()
damageCommand()
tempGUI()
reload()
randomRickAndMortyCharacter()
damageCompleter(
translationModule = translationModule
)
damageCommand(
translationModule = translationModule
)
tempGUI(
guisFactories = guiFactories
)
reload(
translationModule = translationModule
)
randomRickAndMortyCharacter(
repositoryModule = repositoryModule
)

// It shows that [val XXX by IReloadable] is actually affected by reloading
AstraTemplate.instance.registerCommand("translation") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ object ServiceLocator {
}
val commandManager = module {
CommandManager(
translationModule = TranslationModule
translationModule = TranslationModule,
repositoryModule = RepositoryModule,
guiFactories = Guis
)
}

Expand Down

0 comments on commit cafb4f1

Please sign in to comment.