Skip to content

Commit 1ae3eef

Browse files
Add StopNoteblock() function
1 parent ed71ce5 commit 1ae3eef

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

noteblockplayer.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,23 @@ func PlayNoteblock(eh *world.EntityHandle, filename string) error {
269269
return nil
270270
}
271271

272+
// StopNoteblock is a helper function to stop the currently playing noteblock song for a player.
273+
//
274+
// Accepts player handle (EntityHandle).
275+
// Returns true if a song was stopped, false if no song was playing.
276+
//
277+
// Example usage (from any Go function with *player.Player object `p`):
278+
//
279+
// success := StopNoteblock(p.H())
280+
// if success {
281+
// // song stopped
282+
// } else {
283+
// // no song was playing
284+
// }
285+
func StopNoteblock(eh *world.EntityHandle) bool {
286+
return stopSong(eh)
287+
}
288+
272289
// --------------- Command Registration ---------------
273290

274291
// init registers all noteblock-related player commands.

0 commit comments

Comments
 (0)