Navoei / CustomDiscs

A Paper plugin to add custom music discs using the Simple Voice Chat API.
MIT License
60 stars 15 forks source link

send a song to player #15

Open Diclo opened 1 year ago

Diclo commented 1 year ago

add feature to play song to specific player using a command, example: /customsong

Navoei commented 1 year ago

this seems like a nice feature for moderators to use :) although i dont know about playing it to a specific player i believe everyone else is going to be able to hear it

TraipsingShadow commented 1 year ago

I agree with this! To add to the idea, if it is possible, could you add "location" parameters? Say, you want a certain song to play in an area when a player clicks a button.

This button is linked to a command block which issues the /customdisc command. A hypothetical command would look like this:

/customdisc playsong <Song Title> [atTarget, atPlayer, atLocation] [<@a, @e, @p>, <PlayerName>, <X Y Z>] loop [true, false] [<integer amount to loop, -1 for unlimited>]

Examples:

To start playing a song originating from around a specific player: /customdisc playsong "CrabRave.mp3" atPlayer Navoei

To start playing a song at the nearest player [presumably from a command block]: /customdisc playsong "CrabRave.mp3" atTarget @p

To start playing a looped song forever at a specific location: /customdisc playsong "CrabRave.mp3" atLocation 100 64 110 loop true -1

Navoei commented 1 year ago

The target system seems like something that would not be very optimized. This is because the plugin will have to create a new audio channel for every single target. If you do @e that will probably crash the server. atPlayer and atLocation are possible to do. Still, stopping the sound after it has started playing will be an issue. The command will require coordinates (/stopdisc <X Y Z>). A player can move and therefore not be at the same location. I might experiment with different ways in which the voicechat plugin sends audio packets but for now i have no ETA on when this will be worked on.