fix: fix loopPosition in Song

This commit is contained in:
Chayapak 2024-11-12 16:09:00 +07:00
parent 4b2b1e9e1a
commit 7363252660
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
2 changed files with 3 additions and 3 deletions

View file

@ -17,7 +17,7 @@ public class Song {
public long startTime = 0; // Start time in millis since unix epoch public long startTime = 0; // Start time in millis since unix epoch
public long length = 0; // Milliseconds in the song public long length = 0; // Milliseconds in the song
public long time = 0; // Time since start of song public long time = 0; // Time since start of song
public long loopPosition = 200; // Milliseconds into the song to start looping public long loopPosition = 0; // Milliseconds into the song to start looping
public final Map<Long, String> lyrics = new HashMap<>(); public final Map<Long, String> lyrics = new HashMap<>();
@ -80,7 +80,7 @@ public class Song {
*/ */
public void play () { public void play () {
if (paused) { if (paused) {
if (loopPosition != 200) bot.music.loop = Loop.CURRENT; if (loopPosition != 0) bot.music.loop = Loop.CURRENT;
paused = false; paused = false;
startTime = System.currentTimeMillis() - time; startTime = System.currentTimeMillis() - time;
} }

View file

@ -46,7 +46,7 @@ public class SongPlayerConverter implements Converter {
song.length = songLength; song.length = songLength;
// song.looping = loop > 0; // song.looping = loop > 0;
// song.loopCount = loopCount; // song.loopCount = loopCount;
song.loopPosition = loopPosition == 0 ? 200 : loopPosition; song.loopPosition = loopPosition;
long time = 0; long time = 0;
while (true) { while (true) {