diff --git a/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/Config.kt b/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/Config.kt index 2481c769..ba4702fb 100644 --- a/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/Config.kt +++ b/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/Config.kt @@ -7,7 +7,7 @@ object Config : EnvironmentConfig() { val POD_ID by getEnv(transform = String::toInt) val SHARDS_PER_POD by getEnv(2, String::toInt) val TOTAL_SHARDS by getEnv(transform = String::toInt) - val PORT by getEnv(8081, String::toInt) + val KUBERNETES_PORT by getEnv(8081, String::toInt) val STATEFUL_SET_NAME by this val NAMESPACE by getEnv("default") val CONTAINER_NAME by this diff --git a/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/KubernetesAPIServer.kt b/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/KubernetesAPIServer.kt index 6075afa3..76917458 100644 --- a/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/KubernetesAPIServer.kt +++ b/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/KubernetesAPIServer.kt @@ -15,7 +15,7 @@ import io.ktor.server.routing.* import mu.KotlinLogging fun startServer(checks: List, context: PluginContext) = - embeddedServer(Netty, Config.PORT) { + embeddedServer(Netty, Config.KUBERNETES_PORT) { install(Resources) routing { diff --git a/music/build.gradle.kts b/music/build.gradle.kts index ae0ce115..b1beb1a7 100644 --- a/music/build.gradle.kts +++ b/music/build.gradle.kts @@ -1,5 +1,5 @@ subprojects { - version = "4.2.0-SNAPSHOT" + version = "4.3.0-SNAPSHOT" repositories { maven("https://maven.topi.wtf/releases") diff --git a/music/player/src/main/kotlin/dev/schlaubi/mikmusic/core/MusicModule.kt b/music/player/src/main/kotlin/dev/schlaubi/mikmusic/core/MusicModule.kt index 60ded267..e5694077 100644 --- a/music/player/src/main/kotlin/dev/schlaubi/mikmusic/core/MusicModule.kt +++ b/music/player/src/main/kotlin/dev/schlaubi/mikmusic/core/MusicModule.kt @@ -39,6 +39,7 @@ import kotlinx.coroutines.launch import org.koin.core.component.inject import org.litote.kmongo.serialization.registerSerializer import org.pf4j.ExtensionPoint +import java.util.concurrent.ConcurrentHashMap import kotlin.reflect.KMutableProperty1 interface MusicExtensionPoint : ExtensionPoint { @@ -47,7 +48,7 @@ interface MusicExtensionPoint : ExtensionPoint { class MusicModule(context: PluginContext) : MikBotModule(context) { private val lavalink: LavalinkManager by extension() - private val musicPlayers: MutableMap = mutableMapOf() + private val musicPlayers: MutableMap = ConcurrentHashMap() override val name: String = "music" override val allowApplicationCommandInDMs: Boolean = false diff --git a/music/player/src/main/kotlin/dev/schlaubi/mikmusic/player/MusicPlayer.kt b/music/player/src/main/kotlin/dev/schlaubi/mikmusic/player/MusicPlayer.kt index c8b144ad..233e01de 100644 --- a/music/player/src/main/kotlin/dev/schlaubi/mikmusic/player/MusicPlayer.kt +++ b/music/player/src/main/kotlin/dev/schlaubi/mikmusic/player/MusicPlayer.kt @@ -141,7 +141,7 @@ class MusicPlayer(val link: Link, private val guild: GuildBehavior) : Link by li return remainingTrackDuration + remainingQueue } - val nextSongIsFirst: Boolean get() = queue.isEmpty() && link.player.playingTrack == null + val nextSongIsFirst: Boolean get() = queue.isEmpty() && playingTrack == null suspend fun queueTrack( force: Boolean, @@ -229,7 +229,7 @@ class MusicPlayer(val link: Link, private val guild: GuildBehavior) : Link by li updateMusicChannelMessage() } - private fun onTrackStart(@Suppress("unused") event: TrackStartEvent) { + private fun onTrackStart(@Suppress("unused_parameter") event: TrackStartEvent) { leaveTimeout?.cancel() updateMusicChannelMessage() } @@ -300,7 +300,6 @@ class MusicPlayer(val link: Link, private val guild: GuildBehavior) : Link by li } if (canSkip) { startNextSong() - updateMusicChannelMessage() } else { stop() } @@ -321,7 +320,6 @@ class MusicPlayer(val link: Link, private val guild: GuildBehavior) : Link by li queue.addTracks(SimpleQueuedTrack(autoPlayTrack, guild.kord.selfId)) } if (queue.isEmpty() && !repeat) { - updateMusicChannelMessage() return } val nextTrack: QueuedTrack = when {