diff --git a/build-number.txt b/build-number.txt index 75748595..5710984f 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -2726 \ No newline at end of file +2747 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/plugins/MusicPlayerPlugin.java b/src/main/java/me/chayapak1/chomens_bot/plugins/MusicPlayerPlugin.java index 6c75dbdd..16e36a4f 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/MusicPlayerPlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/MusicPlayerPlugin.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; +import java.text.DecimalFormat; import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -328,10 +329,24 @@ public class MusicPlayerPlugin extends Bot.Listener implements CorePlugin.Listen formatTime((long) (currentSong.length * speed)).color(NamedTextColor.GRAY)).color(NamedTextColor.DARK_GRAY) ); - if (!bot.core.hasRateLimit() && !currentLyrics.isEmpty()) { + final DecimalFormat formatter = new DecimalFormat("#,###"); + + if (!bot.core.hasRateLimit()) { component = component - .append(Component.text(" | ", NamedTextColor.DARK_GRAY)) - .append(Component.text(currentLyrics).color(NamedTextColor.BLUE)); + .append(Component.text(" | ").color(NamedTextColor.DARK_GRAY)) + .append( + Component.translatable( + "%s / %s", + Component.text(formatter.format(currentSong.position), NamedTextColor.GRAY), + Component.text(formatter.format(currentSong.size()), NamedTextColor.GRAY) + ).color(NamedTextColor.DARK_GRAY) + ); + + if (!currentLyrics.isBlank()) { + component = component + .append(Component.text(" | ", NamedTextColor.DARK_GRAY)) + .append(Component.text(currentLyrics).color(NamedTextColor.BLUE)); + } } if (currentSong.paused) { @@ -376,18 +391,16 @@ public class MusicPlayerPlugin extends Bot.Listener implements CorePlugin.Listen public void handlePlaying () { if (currentSong == null) return; - try { - currentSong.advanceTime(); - while (currentSong.reachedNextNote()) { - final Note note = currentSong.getNextNote(); + currentSong.advanceTime(); + while (currentSong.reachedNextNote()) { + final Note note = currentSong.getNextNote(); + try { if (note.isRainbowToggle) { rainbow = !rainbow; continue; } - if (note.volume == 0) continue; - double key = note.shiftedPitch; final Vector3d blockPosition = getBlockPosition(note); @@ -439,9 +452,9 @@ public class MusicPlayerPlugin extends Bot.Listener implements CorePlugin.Listen MathUtilities.clamp(floatingPitch, 0, 2) ); } + } catch (final Exception e) { + bot.logger.error(e); } - } catch (final Exception e) { - bot.logger.error(e); } } diff --git a/src/main/java/me/chayapak1/chomens_bot/song/NBSConverter.java b/src/main/java/me/chayapak1/chomens_bot/song/NBSConverter.java index 2d8f262a..87a8dffc 100644 --- a/src/main/java/me/chayapak1/chomens_bot/song/NBSConverter.java +++ b/src/main/java/me/chayapak1/chomens_bot/song/NBSConverter.java @@ -213,7 +213,9 @@ public class NBSConverter implements Converter { if (name.equals("Tempo Changer")) { isTempoChanger = true; - tempo = (double) Math.abs(note.pitch) * 100 / 15; + // causes issues :( + // (more specifically empty gaps after the tempo has been changed) + // tempo = (double) Math.abs(note.pitch) * 100 / 15; } else if (name.equals("Toggle Rainbow")) { isRainbowToggle = true; } diff --git a/src/main/java/me/chayapak1/chomens_bot/song/Song.java b/src/main/java/me/chayapak1/chomens_bot/song/Song.java index e7959f8d..f8ae460c 100644 --- a/src/main/java/me/chayapak1/chomens_bot/song/Song.java +++ b/src/main/java/me/chayapak1/chomens_bot/song/Song.java @@ -139,9 +139,7 @@ public class Song { } public Note getNextNote () { - if (position >= notes.size()) { - if (bot.music.loop == Loop.OFF) return null; - } + if (position >= notes.size() && bot.music.loop == Loop.OFF) return null; return notes.get(position++); }