X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FStartupHandler.kt;h=3776d43ba927681d942ad3fcb80901e9e34bb9ad;hp=392aa5c74f48ad0995178698d68326a92a5039b7;hb=438378deab1514f0f608d975ef65f5b7aea44ccb;hpb=742d893ed6941719f4612887197429ea903ab62f diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/StartupHandler.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/StartupHandler.kt index 392aa5c..3776d43 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/StartupHandler.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/StartupHandler.kt @@ -1,5 +1,5 @@ /** - * Sone - StartupHandler.kt - Copyright © 2019 David ‘Bombe’ Roden + * Sone - StartupHandler.kt - Copyright © 2019–2020 David ‘Bombe’ Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,14 +22,18 @@ import net.pterodactylus.sone.core.event.* import net.pterodactylus.util.notify.* import java.util.concurrent.* import java.util.concurrent.TimeUnit.* +import javax.inject.* /** * Handler for the [Startup] event notification. */ -class StartupHandler(private val notificationManager: NotificationManager, private val notification: TemplateNotification, val ticker: ScheduledExecutorService) { +class StartupHandler @Inject constructor( + private val notificationManager: NotificationManager, + @Named("startup") private val notification: TemplateNotification, + @Named("notification") private val ticker: ScheduledExecutorService) { @Subscribe - fun startup(startup: Startup) { + fun startup(@Suppress("UNUSED_PARAMETER") startup: Startup) { notificationManager.addNotification(notification) ticker.schedule({ notificationManager.removeNotification(notification) }, 2, MINUTES) }