This commit is contained in:
Chipmunk 2023-02-25 13:43:14 -05:00
parent 686c7d469a
commit b4039a5965

View file

@ -20,6 +20,7 @@ import java.util.LinkedList;
public class SongPlayer extends SessionAdapter { public class SongPlayer extends SessionAdapter {
private final ChipmunkBot client; private final ChipmunkBot client;
public static final String SELECTOR = "@a[tag=!nomusic,tag=!chipmunkbot_nomusic]";
public static File SONG_DIR = new File("songs"); public static File SONG_DIR = new File("songs");
static { static {
if (!SONG_DIR.exists()) { if (!SONG_DIR.exists()) {
@ -85,7 +86,7 @@ public class SongPlayer extends SessionAdapter {
if (currentSong.paused && ticksUntilPausedActionbar-- < 0) return; if (currentSong.paused && ticksUntilPausedActionbar-- < 0) return;
else ticksUntilPausedActionbar = 20; else ticksUntilPausedActionbar = 20;
client.core().run("title @a actionbar " + GsonComponentSerializer.gson().serialize(generateActionbar())); client.core().run("title " + SELECTOR + " actionbar " + GsonComponentSerializer.gson().serialize(generateActionbar()));
if (currentSong.paused) return; if (currentSong.paused) return;
@ -164,7 +165,7 @@ public class SongPlayer extends SessionAdapter {
final double floatingPitch = Math.pow(2, (note.pitch - 12) / 12.0); final double floatingPitch = Math.pow(2, (note.pitch - 12) / 12.0);
client.core().run("execute as @a at @s run playsound " + note.instrument.sound + " record @s ~ ~ ~ " + note.volume + " " + floatingPitch); client.core().run("execute as " + SELECTOR + " at @s run playsound " + note.instrument.sound + " record @s ~ ~ ~ " + note.volume + " " + floatingPitch);
} }
} }
} }