X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fmain%2FSoneModule.kt;fp=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fmain%2FSoneModule.kt;h=31cc54a365a513093361f45e98393b20b66bb96a;hp=66cd29a662d64c6ce5876c91a8912c1069c6df18;hb=33b58cb4388ee7ca267470c0d883653e1a16dff4;hpb=d0035d64e2acd25cc76c6d0bdb577cf206d259a9 diff --git a/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt b/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt index 66cd29a..31cc54a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt @@ -16,7 +16,7 @@ import net.pterodactylus.util.config.ConfigurationException import net.pterodactylus.util.version.Version import java.io.* -class SoneModule(private val sonePlugin: SonePlugin) : AbstractModule() { +open class SoneModule(private val sonePlugin: SonePlugin, private val eventBus: EventBus) : AbstractModule() { override fun configure() { val sonePropertiesFile = File("sone.properties") @@ -37,7 +37,6 @@ class SoneModule(private val sonePlugin: SonePlugin) : AbstractModule() { .getValue(null) ?.let { DebugLoaders(it) } } - val eventBus = EventBus() bind(Configuration::class.java).toInstance(configuration) bind(EventBus::class.java).toInstance(eventBus) @@ -66,7 +65,7 @@ class SoneModule(private val sonePlugin: SonePlugin) : AbstractModule() { fun getCore(configuration: Configuration, freenetInterface: FreenetInterface, identityManager: IdentityManager, soneDownloader: SoneDownloader, imageInserter: ImageInserter, updateChecker: UpdateChecker, webOfTrustUpdater: WebOfTrustUpdater, eventBus: EventBus, database: Database) = Core(configuration, freenetInterface, identityManager, soneDownloader, imageInserter, updateChecker, webOfTrustUpdater, eventBus, database).apply { debugInformation.showVersionInformation = configuration.getBooleanValue("Debug/ShowVersionInformation").getValue(false) - } + }.also(eventBus::register) }