diff --git a/src/main/java/moe/nekojimi/chords/QueueManager.java b/src/main/java/moe/nekojimi/chords/QueueManager.java index 2200392..021c0fb 100644 --- a/src/main/java/moe/nekojimi/chords/QueueManager.java +++ b/src/main/java/moe/nekojimi/chords/QueueManager.java @@ -26,6 +26,8 @@ import java.util.function.Consumer; */ public class QueueManager implements Consumer { + + private Song restartingSong = null; private final Queue jukeboxQueue; private Playlist playlist; private MusicHandler handler; @@ -52,6 +54,13 @@ public class QueueManager implements Consumer */ public Song nextSongNeeded() { + // if we're restarting the current song: store, clear, and return it + if (restartingSong != null) + { + Song ret = restartingSong; + restartingSong = null; + return ret; + } // if there's anything in the queue, play that first if (!jukeboxQueue.isEmpty()) { @@ -118,6 +127,12 @@ public class QueueManager implements Consumer public boolean restartSong() { - throw new UnsupportedOperationException("Not supported yet."); + restartingSong = handler.getCurrentSong(); + if (restartingSong != null) + { + handler.playNext(); + return true; + } else + return false; } }