🐛 fix playlists loading only first audio
All checks were successful
Build and Push Docker Image / build (push) Successful in 2m41s
All checks were successful
Build and Push Docker Image / build (push) Successful in 2m41s
This commit is contained in:
parent
c112781ee6
commit
f58669e522
@ -11,6 +11,7 @@ import net.dv8tion.jda.api.entities.Guild;
|
|||||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PlayerManager {
|
public class PlayerManager {
|
||||||
@ -41,7 +42,7 @@ public class PlayerManager {
|
|||||||
|
|
||||||
public void loadAndPlay(GuildMessageChannel channel, String url) {
|
public void loadAndPlay(GuildMessageChannel channel, String url) {
|
||||||
final GuildMusicManager musicManager = getMusicManager(channel.getGuild());
|
final GuildMusicManager musicManager = getMusicManager(channel.getGuild());
|
||||||
|
|
||||||
audioPlayerManager.loadItemOrdered(musicManager, url, new AudioLoadResultHandler() {
|
audioPlayerManager.loadItemOrdered(musicManager, url, new AudioLoadResultHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void trackLoaded(AudioTrack track) {
|
public void trackLoaded(AudioTrack track) {
|
||||||
@ -51,9 +52,14 @@ public class PlayerManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playlistLoaded(AudioPlaylist playlist) {
|
public void playlistLoaded(AudioPlaylist playlist) {
|
||||||
final AudioTrack track = playlist.getTracks().get(0);
|
List<AudioTrack> tracks = playlist.getTracks();
|
||||||
musicManager.scheduler.queue(track);
|
|
||||||
channel.sendMessage("Ajout à la file d'attente: `" + track.getInfo().title + "`").queue();
|
channel.sendMessage(
|
||||||
|
"Ajout à la file d'attente: `" + playlist.getName() + "` - " + tracks.size() + " musiques.")
|
||||||
|
.queue();
|
||||||
|
|
||||||
|
for (AudioTrack track : tracks)
|
||||||
|
musicManager.scheduler.queue(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user