Ensure tracks play in the correct order by using PriorityQueue.

master
Nekojimi 1 year ago
parent 310158a39b
commit 07b45309c1
  1. 6
      src/main/java/moe/nekojimi/chords/QueueManager.java

@ -16,7 +16,9 @@
*/ */
package moe.nekojimi.chords; package moe.nekojimi.chords;
import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue; import java.util.Queue;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -28,13 +30,13 @@ public class QueueManager implements Consumer<Song>
{ {
private Song restartingSong = null; private Song restartingSong = null;
private final Queue<Song> jukeboxQueue; private final PriorityQueue<Song> jukeboxQueue = new PriorityQueue<>();
private Playlist playlist; private Playlist playlist;
private MusicHandler handler; private MusicHandler handler;
public QueueManager() public QueueManager()
{ {
jukeboxQueue = new LinkedList<>(); // jukeboxQueue = new LinkedList<>();
} }
@Override @Override

Loading…
Cancel
Save