From 22c80f529b4394c2b8f2a15ea8dcad62916e05f8 Mon Sep 17 00:00:00 2001 From: duncte123 Date: Thu, 8 Feb 2024 19:39:41 +0100 Subject: [PATCH] lint code --- .../main/java/fredboat/audio/player/LavalinkManager.java | 6 +----- .../me/duncte123/skybot/commands/music/PauseCommand.kt | 2 +- .../me/duncte123/skybot/commands/music/RadioCommand.kt | 1 - .../me/duncte123/skybot/commands/music/VolumeCommand.kt | 1 - 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/bot/src/main/java/fredboat/audio/player/LavalinkManager.java b/bot/src/main/java/fredboat/audio/player/LavalinkManager.java index 958e3cbfa..62c3d9949 100644 --- a/bot/src/main/java/fredboat/audio/player/LavalinkManager.java +++ b/bot/src/main/java/fredboat/audio/player/LavalinkManager.java @@ -111,11 +111,7 @@ public boolean isConnected(long guildId) { final var link = lavalink.getLinkIfCached(guildId); - if (link == null) { - return false; - } - - return link.getState() == LinkState.CONNECTED; + return link != null && link.getState() == LinkState.CONNECTED; } @SuppressWarnings("ConstantConditions") // cache is enabled diff --git a/bot/src/main/kotlin/me/duncte123/skybot/commands/music/PauseCommand.kt b/bot/src/main/kotlin/me/duncte123/skybot/commands/music/PauseCommand.kt index f7b118c71..fc720d824 100644 --- a/bot/src/main/kotlin/me/duncte123/skybot/commands/music/PauseCommand.kt +++ b/bot/src/main/kotlin/me/duncte123/skybot/commands/music/PauseCommand.kt @@ -53,7 +53,7 @@ class PauseCommand : MusicCommand() { val mng = variables.audioUtils.getMusicManager(event.guild!!.idLong) val localPlayer = mng.player - localPlayer.ifPresentOrElse({player -> + localPlayer.ifPresentOrElse({ player -> if (player.track == null) { event.reply("Cannot pause or resume player because no track is loaded for playing.").queue() return@ifPresentOrElse diff --git a/bot/src/main/kotlin/me/duncte123/skybot/commands/music/RadioCommand.kt b/bot/src/main/kotlin/me/duncte123/skybot/commands/music/RadioCommand.kt index cdddc6fac..3ecd360de 100644 --- a/bot/src/main/kotlin/me/duncte123/skybot/commands/music/RadioCommand.kt +++ b/bot/src/main/kotlin/me/duncte123/skybot/commands/music/RadioCommand.kt @@ -27,7 +27,6 @@ import me.duncte123.skybot.objects.RadioStream import me.duncte123.skybot.objects.command.CommandContext import me.duncte123.skybot.objects.command.MusicCommand import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent -import kotlin.jvm.optionals.getOrNull class RadioCommand : MusicCommand() { var radioStreams = arrayListOf() diff --git a/bot/src/main/kotlin/me/duncte123/skybot/commands/music/VolumeCommand.kt b/bot/src/main/kotlin/me/duncte123/skybot/commands/music/VolumeCommand.kt index 49768e728..2d7e5e390 100644 --- a/bot/src/main/kotlin/me/duncte123/skybot/commands/music/VolumeCommand.kt +++ b/bot/src/main/kotlin/me/duncte123/skybot/commands/music/VolumeCommand.kt @@ -27,7 +27,6 @@ import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEve import net.dv8tion.jda.api.interactions.commands.OptionType import net.dv8tion.jda.api.interactions.commands.build.OptionData import net.dv8tion.jda.api.interactions.commands.build.SubcommandData -import kotlin.jvm.optionals.getOrNull import kotlin.math.max import kotlin.math.min