X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fmain%2FSoneModule.kt;h=31cc54a365a513093361f45e98393b20b66bb96a;hb=33b58cb4388ee7ca267470c0d883653e1a16dff4;hp=07ec56ee0cd14e4608331db6ac022ed0995be3b8;hpb=6ac356bc119250192e68934894bf9f5eedc4989c;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt b/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt index 07ec56e..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) @@ -62,10 +61,11 @@ class SoneModule(private val sonePlugin: SonePlugin) : AbstractModule() { } @Provides + @Singleton 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) }