forked from ChomeNS/chomens-bot-java
FIX music nbs looping
well not entirely because we still have the loop count but i think i will never implement that because im lazy owo
This commit is contained in:
parent
e68b3dfc8c
commit
106b55bcc3
2 changed files with 10 additions and 1 deletions
|
@ -127,7 +127,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
|||
|
||||
if (currentSong.finished()) {
|
||||
if (loop == Loop.CURRENT) {
|
||||
currentSong.setTime(0);
|
||||
currentSong.loop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,6 +105,15 @@ public class Song {
|
|||
}
|
||||
}
|
||||
|
||||
public void loop () {
|
||||
position = 0;
|
||||
startTime += length - loopPosition;
|
||||
time -= length - loopPosition;
|
||||
while (position < notes.size() && notes.get(position).time < loopPosition) {
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
||||
public Note getNextNote () {
|
||||
if (position >= notes.size()) {
|
||||
if (bot.music.loop == Loop.OFF) return null;
|
||||
|
|
Loading…
Reference in a new issue