From c61239de105f26d7680c8338b4c346192955c37a Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 22 Aug 2022 23:11:07 -0700 Subject: [PATCH] Limit max volume to 150% Added a small if statement to ensure that the max volume matches the command usage and cannot reach 1000% --- src/main/kotlin/dev/arbjerg/ukulele/command/VolumeCommand.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/dev/arbjerg/ukulele/command/VolumeCommand.kt b/src/main/kotlin/dev/arbjerg/ukulele/command/VolumeCommand.kt index 879e2689..6367e215 100644 --- a/src/main/kotlin/dev/arbjerg/ukulele/command/VolumeCommand.kt +++ b/src/main/kotlin/dev/arbjerg/ukulele/command/VolumeCommand.kt @@ -16,7 +16,10 @@ class VolumeCommand(val players: PlayerRegistry) : Command("volume", "v") { ?: return replyHelp() val formerVolume = player.volume + + if (num > 150) num = 150 player.volume = num + reply("Changed volume from ${formerVolume}% to ${player.volume}%.") } @@ -26,4 +29,4 @@ class VolumeCommand(val players: PlayerRegistry) : Command("volume", "v") { addUsage("<0-150>%") addDescription("Sets the volume to the given percentage.") } -} \ No newline at end of file +}