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:
parent
7106060b92
commit
49f7f533b0
@ -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);
|
Song currentSong = this.songs.get(this.currentlyPlaying);
|
||||||
currentSong.play(trait, trait.getVolume(), trait.getPitch());
|
currentSong.play(trait, trait.getVolume(), trait.getPitch());
|
||||||
currentlyPlaying++;
|
currentlyPlaying++;
|
||||||
|
Loading…
Reference in New Issue
Block a user