Prevents music overlap

Makes sure to actually stop songs played for players outside the global cycle when changing to the next track in a playlist.
This commit is contained in:
Kristian Knarvik 2022-10-31 15:06:17 +01:00
parent 7106060b92
commit 49f7f533b0

View File

@ -126,6 +126,14 @@ public class Playlist {
}
}
//Prevent overlapping music if a song has been played outside the global cycle
for (Player player : playerCurrentSong.keySet()) {
Song currentSong = playerCurrentSong.get(player);
if (currentSong != null) {
currentSong.stop(player);
}
}
Song currentSong = this.songs.get(this.currentlyPlaying);
currentSong.play(trait, trait.getVolume(), trait.getPitch());
currentlyPlaying++;