a note instrument thingy
This commit is contained in:
parent
e5f3c74852
commit
6167af7340
2 changed files with 22 additions and 1 deletions
|
@ -44,6 +44,7 @@ public class MusicCommand extends Command {
|
|||
"goto <timestamp>",
|
||||
"pitch <pitch>",
|
||||
"speed <speed>",
|
||||
"noteinstrument <instrument>",
|
||||
"pause",
|
||||
"resume",
|
||||
"info"
|
||||
|
@ -76,6 +77,7 @@ public class MusicCommand extends Command {
|
|||
case "goto" -> goTo(context, args);
|
||||
case "pitch" -> pitch(context, args);
|
||||
case "speed" -> speed(context, args);
|
||||
case "noteinstrument" -> noteInstrument(context, args);
|
||||
case "pause", "resume" -> pause(context);
|
||||
case "info" -> info(context);
|
||||
default -> Component.text("Invalid action").color(NamedTextColor.RED);
|
||||
|
@ -367,6 +369,23 @@ public class MusicCommand extends Command {
|
|||
.color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
||||
}
|
||||
|
||||
public Component noteInstrument (CommandContext context, String[] args) {
|
||||
final Bot bot = context.bot;
|
||||
|
||||
final String instrument = args[1];
|
||||
|
||||
bot.music.instrument = instrument;
|
||||
|
||||
if (!instrument.equals("off")) {
|
||||
return Component.empty()
|
||||
.append(Component.text("Set the instrument for every note to "))
|
||||
.append(Component.text(instrument).color(ColorUtilities.getColorByString(bot.config.colorPalette.secondary)))
|
||||
.color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
||||
} else {
|
||||
return Component.text("Every notes are now using its instrument").color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
||||
}
|
||||
}
|
||||
|
||||
public Component pause (CommandContext context) {
|
||||
final Bot bot = context.bot;
|
||||
final Song currentSong = bot.music.currentSong;
|
||||
|
|
|
@ -48,6 +48,8 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
|||
public float pitch = 0;
|
||||
public float speed = 1;
|
||||
|
||||
public String instrument = "off";
|
||||
|
||||
private int ticksUntilPausedBossbar = 20;
|
||||
|
||||
private int notesPerSecond = 0;
|
||||
|
@ -317,7 +319,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
|||
"minecraft:execute as " +
|
||||
SELECTOR +
|
||||
" at @s run playsound " +
|
||||
note.instrument.sound +
|
||||
(!instrument.equals("off") ? instrument : note.instrument.sound) +
|
||||
" record @s ^" + blockPosition + " ^ ^ " +
|
||||
note.volume +
|
||||
" " +
|
||||
|
|
Loading…
Reference in a new issue