package net.pterodactylus.sone.main
+import com.codahale.metrics.*
import com.google.common.base.*
import com.google.common.eventbus.*
import com.google.inject.*
bind(Database::class.java).to(MemoryDatabase::class.java).`in`(Singleton::class.java)
bind(BaseL10n::class.java).toInstance(sonePlugin.l10n().base)
loaders?.let { bind(Loaders::class.java).toInstance(it) }
+ bind(MetricRegistry::class.java).`in`(Singleton::class.java)
bindListener(Matchers.any(), object : TypeListener {
override fun <I> hear(typeLiteral: TypeLiteral<I>, typeEncounter: TypeEncounter<I>) {
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)
+ debugInformation.showMetrics = configuration.getBooleanValue("Debug/ShowMetrics").getValue(false)
}.also(eventBus::register)
}