inxomnyaa / PocketRadio

A lightweight .NBS song player for PocketMine Servers
https://poggit.pmmp.io/ci/inxomnyaa/PocketRadio/~
GNU General Public License v3.0
38 stars 9 forks source link

Feature: Per world song #23

Closed benda95280 closed 10 months ago

benda95280 commented 4 years ago

Dear,

Could it be possible to have per world song ?

Thanks for your works, and your time.

inxomnyaa commented 10 months ago

This should definitely be added in form of playlists. I am currently unsure how to implement those in a way that plugins and players can modify those though.

inxomnyaa commented 10 months ago

I have decided that i will leave this feature up to plugins. You can now listen for AddPlayerToPlaylistEvent and cancel it. You can also create your own Playlist object, add songs to it and add / remove players i.e. on world change. I might add some API for scanning a folder for songs so plugins can add them to playlists easier

inxomnyaa commented 10 months ago

Added the API for scanning a folder asynchronously. The loadSongsFromPathAsync() method calls the LoadSongsEvent which can be listened for by plugins. Songs can then be added to the playlist if the name matches. Plugins may filter the loaded songs by song name, filename etc. As the event is called for all songs in the songs folder by default, you may not need to call the loadSongsFromPathAsync() method yourself but only listen for the LoadSongsEvent.