Code?

Discussion in 'Spigot Plugin Development' started by DeadlyDeath001, May 9, 2015.

  1. Code to play sound at the Player Location?
    Would this be right? So Other players can hear It
    sorry testing this out my self, So IDK
    Code (Text):
    player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF,10, 10);
     
  2. Yeah, from looking at it, it's correct
     
  3. A good place to find answers to such questions, have a look at the Javadocs. There you can see explanations of the Methods and may find methods you else would have not looked at.
    The Method you use is here.
    So to answer your question. Yes. Given that the rest of the code arround it is correct
     
  4. Naa man It Don't Work. It Plays Sound For All players in the server
    I Just want it to play sound for at getting the player location and other people can hear if a
    Example: Get close enough to hear the Killing of a mob
    Code (Text):
    event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.GHAST_FIREBALL, 10, 1);
     
  5. Perhaps try to play the sound for the player instead of the world (hint hint)
     
  6. Nope same thing. now it just plays sound to the player it self
    Example: Get close enough to hear the Killing of a mob
    Code (Text):
    event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.GHAST_FIREBALL, 10, 1);
     
  7. Well. You put the Volume to 10. That's AFAIK global or at least quite far. Turn the volume down and not everyone will hear it
     
  8. OHHH Now I solved it!