All sounds are global D:

Discussion in 'Plugin Development' started by Fiddy_percent, Aug 24, 2014.

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


    1. Bukkit.getWorld("world").playSound(loc, Sound.COW_IDLE, 1, 1);

    Everyone can hear it despite it being localised at the player location (yes thats what loc is)
  2. Offline



    Bukkit.getWorld() returns the Entire world, what did you expect :p.

    1. p.playSound(loc, Sound.FART, Integer.MAX_VALUE, 0);

    does the trick ;)

    If you would like to have nearby players hear the sound too, (I think) p.getWorld().playSoun() does that, else you could loop for nearby players and have them play the sound for too!
  3. Offline


    ah thanks

    and I figured is it just needed the world to find the player location
  4. Offline




    does differs from method, the first one is that only you can hear the sounds, the second one is that everyone can hear it.

    getWorld() returns a World object in return which contains the global playSound method, while entity.playSound() is only ment for the entity.

    so in your case if you do: p.playSound(p.getLocation(), Sound.?, ?, ?); you are fine only you can hear it others won't.
    this also works with a random location to aslong you use entity.playSound(otherlocation) and not p.getWorld().playSound(); but beaware that a distance can cause to not hear it:p

    this also counts for effects to.
Thread Status:
Not open for further replies.

Share This Page