From b7807686d0b1fba86248911712f3ce2a9a39ccac Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Mon, 14 Apr 2025 08:22:32 +0700 Subject: [PATCH] fix: patch negative music values causing unexpected behavior --- build-number.txt | 2 +- .../java/me/chayapak1/chomens_bot/commands/MusicCommand.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build-number.txt b/build-number.txt index 018fa277..5ba2c9b7 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -2683 \ No newline at end of file +2684 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java b/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java index 671dbca8..a9f1ceaa 100644 --- a/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java +++ b/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java @@ -439,6 +439,7 @@ public class MusicCommand extends Command { final float speed = context.getFloat(true, false); if (speed > 5) throw new CommandException(Component.text("Too fast!")); + else if (speed < 0) throw new CommandException(Component.text("Invalid speed")); long oldTime = -1; @@ -477,6 +478,7 @@ public class MusicCommand extends Command { final int amplify = context.getInteger(true); if (amplify > 8) throw new CommandException(Component.text("Too big value")); + else if (amplify < 0) throw new CommandException(Component.text("Invalid amplification value")); bot.music.amplify = amplify;