fix: comment out nbs Tempo Changer causing empty gaps after tempo has been changed
refactor: some refactors i've done while inspecting the issue lol feat: re-add note counts
This commit is contained in:
@@ -1 +1 @@
|
||||
2726
|
||||
2747
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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++);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user