Solved Playing records music that follow the player

Discussion in 'Plugin Development' started by wonsz, Mar 24, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    wonsz

    Hello! I'm making simple music plugin for my server. After typing command: /zusic start RECORD_12
    everything works fine, record is playing in the background, but there is a problem.. The music doesn't follow the player. I'm using packet to play record. I'm not sure how to move this sound to the player location.

    Here are the .java files:

    Commands.java

    RecordUtil.java

    Any help is appreciated.
     
  2. Offline

    Zombie_Striker

    @wonsz
    Sounds cannot follow the player.

    If you want a sound to be played wherever the player moves, you will need to increase the volume. Setting it to 500 should be enough to cover most of the world.
     
  3. Offline

    wonsz

    @Zombie_Striker
    Yeah, I don't exactly how to actually raise up volume of these sounds. Can you please show me an example?

    BTW. I'm sorry for mine broken english xD.
     
    Last edited: Mar 24, 2018
  4. Offline

    Zombie_Striker

    @wonsz
    Use Player#playSound(Location, Sound, Volume, Pitch);
    • the location can be anywhere, but this will be the initial center of the sound.
    • Sound is the sound you want to play (so you would put Sound.RECORD_XXX for the record you want)
    • Volume would be the volume
    • Pitch would be the pitch for the sound. The default is 1.
    You would use this method instead of the packets.
     
    wonsz likes this.
  5. Offline

    wonsz

    @Zombie_Striker

    Wow, thanks man. I was sitting almost the whole day trying to get this to work. Thanks once again, have a nice day!
     
Thread Status:
Not open for further replies.

Share This Page