Skip to content

Commit 1100050

Browse files
committed
Allow for seamless song playback when changing the tick in SongPlayer#onSongFinished
1 parent aac1771 commit 1100050

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/net/raphimc/noteblocklib/player/SongPlayer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ protected void tick() {
227227
this.tick++;
228228
if (this.tick >= this.song.getNotes().getLengthInTicks()) {
229229
this.onSongFinished();
230-
return;
230+
if (!this.isRunning()) {
231+
return; // Return if the song got stopped in the onSongFinished method
232+
}
231233
}
232234
if (this.ticksPerSecond != this.song.getTempoEvents().getEffectiveTempo(this.tick)) {
233235
this.ticksPerSecond = this.song.getTempoEvents().getEffectiveTempo(this.tick);

0 commit comments

Comments
 (0)