Add Easter Egg :))

This commit is contained in:
ChomeNS 2023-03-26 11:19:54 +07:00
parent cdc4ab05e7
commit ed34bcd63f
2 changed files with 7 additions and 4 deletions

View file

@ -35,6 +35,9 @@ public class MusicPlayerPlugin extends SessionAdapter {
@Getter @Setter private LinkedList<Song> songQueue = new LinkedList<>(); @Getter @Setter private LinkedList<Song> songQueue = new LinkedList<>();
@Getter @Setter private SongLoaderThread loaderThread; @Getter @Setter private SongLoaderThread loaderThread;
@Getter @Setter private Loop loop = Loop.OFF; @Getter @Setter private Loop loop = Loop.OFF;
@Getter @Setter private boolean nightcore = false; // don't tell anyone plz..,,.,.
private int ticksUntilPausedBossbar = 20; private int ticksUntilPausedBossbar = 20;
private final String bossbarName = "chomens_bot:music"; // maybe make this in the config? private final String bossbarName = "chomens_bot:music"; // maybe make this in the config?
@ -109,7 +112,7 @@ public class MusicPlayerPlugin extends SessionAdapter {
bot.core().run("minecraft:bossbar add " + bossbarName + " \"\""); bot.core().run("minecraft:bossbar add " + bossbarName + " \"\"");
bot.core().run("minecraft:bossbar set " + bossbarName + " players " + SELECTOR); bot.core().run("minecraft:bossbar set " + bossbarName + " players " + SELECTOR);
bot.core().run("minecraft:bossbar set " + bossbarName + " name " + GsonComponentSerializer.gson().serialize(generateBossbar())); bot.core().run("minecraft:bossbar set " + bossbarName + " name " + GsonComponentSerializer.gson().serialize(generateBossbar()));
bot.core().run("minecraft:bossbar set " + bossbarName + " color yellow"); bot.core().run("minecraft:bossbar set " + bossbarName + " color " + (nightcore ? "purple" : "yellow"));
bot.core().run("minecraft:bossbar set " + bossbarName + " visible true"); bot.core().run("minecraft:bossbar set " + bossbarName + " visible true");
bot.core().run("minecraft:bossbar set " + bossbarName + " style progress"); bot.core().run("minecraft:bossbar set " + bossbarName + " style progress");
bot.core().run("minecraft:bossbar set " + bossbarName + " value " + (int) Math.floor(currentSong.time)); bot.core().run("minecraft:bossbar set " + bossbarName + " value " + (int) Math.floor(currentSong.time));
@ -175,7 +178,7 @@ public class MusicPlayerPlugin extends SessionAdapter {
final DecimalFormat formatter = new DecimalFormat("#,###"); final DecimalFormat formatter = new DecimalFormat("#,###");
Component component = Component.empty() Component component = Component.empty()
.append(Component.empty().append(currentSong.name).color(NamedTextColor.GREEN)) .append(Component.empty().append(currentSong.name).color(nightcore ? NamedTextColor.LIGHT_PURPLE : NamedTextColor.GREEN))
.append(Component.text(" | ").color(NamedTextColor.DARK_GRAY)) .append(Component.text(" | ").color(NamedTextColor.DARK_GRAY))
.append(Component.translatable("%s / %s", formatTime(currentSong.time).color(NamedTextColor.GRAY), formatTime(currentSong.length).color(NamedTextColor.GRAY)).color(NamedTextColor.DARK_GRAY)) .append(Component.translatable("%s / %s", formatTime(currentSong.time).color(NamedTextColor.GRAY), formatTime(currentSong.length).color(NamedTextColor.GRAY)).color(NamedTextColor.DARK_GRAY))
.append(Component.text(" | ").color(NamedTextColor.DARK_GRAY)) .append(Component.text(" | ").color(NamedTextColor.DARK_GRAY))
@ -232,7 +235,7 @@ public class MusicPlayerPlugin extends SessionAdapter {
while (currentSong.reachedNextNote()) { while (currentSong.reachedNextNote()) {
final Note note = currentSong.getNextNote(); final Note note = currentSong.getNextNote();
final double floatingPitch = Math.pow(2, (note.pitch - 12) / 12.0); final double floatingPitch = Math.pow(2, ((nightcore ? note.pitch + 1 : note.pitch) - 12) / 12.0);
bot.core().run("minecraft:execute as " + SELECTOR + " at @s run playsound " + note.instrument.sound + " record @s ~ ~ ~ " + note.volume + " " + floatingPitch); bot.core().run("minecraft:execute as " + SELECTOR + " at @s run playsound " + note.instrument.sound + " record @s ~ ~ ~ " + note.volume + " " + floatingPitch);
} }

View file

@ -77,7 +77,7 @@ public class Song {
public boolean reachedNextNote () { public boolean reachedNextNote () {
if (position < notes.size()) { if (position < notes.size()) {
return notes.get(position).time <= time; return notes.get(position).time <= (bot.music().nightcore() ? time - 8 : time);
} else { } else {
if (finished() && bot.music().loop() != Loop.OFF) { if (finished() && bot.music().loop() != Loop.OFF) {
if (position < notes.size()) { if (position < notes.size()) {