Playing a record

Discussion in 'Plugin Development' started by boniomri, Jul 25, 2014.

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

    boniomri

    What I want to do is quite simple.
    I have my own custom resource pack with custom sounds and I want to play music in specific regions.
    For the region part im going to use :
    http://dev.bukkit.org/bukkit-plugins/worldguard-region-events/
    For playing the sound part I have no idea how I can play it repeatedly when someone is in a region.

    I removed the normal juke box sounds and placed the custom sounds I have, so is there a way to play a sound like from a jukebox repeatedly ?
     
  2. Offline

    Niknea

    boniomri
    PHP:
    Bukkit.getServer().playSound();
    You can then use a repeating task to constantly play the sound.
     
  3. Offline

    boniomri

    Niknea
    Then now there are two things you left un answered. When the player leaves the region how can the event stop the sound? And how can the repeating task know when the sound ends to play it again.
     
  4. Offline

    Niknea

    boniomri Question one, create a runnable instead of repeating task, as you can cancel it, listen to when they leave the region, and cancel the runnable.

    Question two, it won't, time how long it'll take, and set the repeating task to play the sound after that amount of time.
     
  5. Offline

    boniomri

    Niknea
    Can you give code example please?
     
  6. Offline

    Niknea

  7. Offline

    boniomri

    Niknea
    Implementing what you said.
     
  8. Offline

    Niknea

Thread Status:
Not open for further replies.

Share This Page