OK, so I am making a plugin for my friend, it's quite simple.
I just don't understand how this is not working... It only sends the sound to one online player instead of everyone..
Here's my code:
This is in an onCommand btw.
I hope someone can help explain why this isn't working, thanks
-XtremeGamer572
I just don't understand how this is not working... It only sends the sound to one online player instead of everyone..
Here's my code:
for (Player pl : Bukkit.getServer().getOnlinePlayers()) {
pl.playSound(pl.getLocation(), configSound, 1, 1);
}
return true;
This is in an onCommand btw.
I hope someone can help explain why this isn't working, thanks
-XtremeGamer572
Create an account or sign in to comment.
3
12/24/2013 10:44 am
This reply was removed by the poster or a moderator.
1
I shouldn't think so, otherwise I would get errors, or no one would be able to hear the sound. Only one person on the server can hear it, or maybe one person on the server cannot hear it, not sure, but when someone dies, the player that it chooses to send the sound to changes, even though I have nothing in a onDeathEvent event.
Bukkit seems to hate me.. xD
Bukkit seems to hate me.. xD
1
What are the parameters of playSound in Player? You could be sending to just one person. (Not very experienced with Bukkit)
1
for (Player pl : Bukkit.getServer().getOnlinePlayers()) {
That right there is making pl (Players) be equal to all online players. I am really confused, because I used the exact same code as in my other plugin, which works perfectly.
That right there is making pl (Players) be equal to all online players. I am really confused, because I used the exact same code as in my other plugin, which works perfectly.