feat: *music volume (finally lol)

This commit is contained in:
ChomeNS
2025-04-10 11:14:49 +07:00
parent 21ba029e42
commit 29ca22101a
3 changed files with 21 additions and 3 deletions

View File

@@ -1 +1 @@
2589
2591

View File

@@ -52,6 +52,7 @@ public class MusicCommand extends Command {
"goto <timestamp>",
"pitch <pitch>",
"speed <speed>",
"volume <volume modifier>",
"amplify <amplification>",
"noteinstrument <instrument>",
"pause",
@@ -61,7 +62,7 @@ public class MusicCommand extends Command {
new String[] { "song" },
TrustLevel.PUBLIC,
false,
new ChatPacketType[]{ ChatPacketType.DISGUISED }
new ChatPacketType[] { ChatPacketType.DISGUISED }
);
}
@@ -84,6 +85,7 @@ public class MusicCommand extends Command {
case "goto" -> goTo(context);
case "pitch" -> pitch(context);
case "speed" -> speed(context);
case "volume" -> volume(context);
case "amplify" -> amplify(context);
case "noteinstrument" -> noteInstrument(context);
case "pause", "resume" -> pause(context);
@@ -451,6 +453,21 @@ public class MusicCommand extends Command {
.color(bot.colorPalette.defaultColor);
}
public Component volume (final CommandContext context) throws CommandException {
context.checkOverloadArgs(2);
final Bot bot = context.bot;
final float volume = context.getFloat(true, false);
bot.music.volume = volume;
return Component.empty()
.append(Component.text("Set the volume modifier to "))
.append(Component.text(volume).color(bot.colorPalette.number))
.color(bot.colorPalette.defaultColor);
}
public Component amplify (final CommandContext context) throws CommandException {
context.checkOverloadArgs(2);

View File

@@ -56,6 +56,7 @@ public class MusicPlayerPlugin extends Bot.Listener implements CorePlugin.Listen
public float pitch = 0;
public float speed = 1;
public float volume = 0;
public int amplify = 1;
public boolean rainbow = false; // nbs easter egg
@@ -402,7 +403,7 @@ public class MusicPlayerPlugin extends Bot.Listener implements CorePlugin.Listen
note.pitch != note.shiftedPitch ||
note.shiftedInstrument != note.instrument;
final double volume = note.volume;
final double volume = note.volume + this.volume;
if (shouldCustomPitch) {
bot.core.run(