diff options
author | sunkid <sunkid@iminurnetz.com> | 2011-06-09 12:37:27 -0700 |
---|---|---|
committer | sunkid <sunkid@iminurnetz.com> | 2011-06-09 12:37:27 -0700 |
commit | 5fe9ac362b7e65721a9d31b1c366d7b92da877f7 (patch) | |
tree | 94197b52a56fcdf46c54555063966535b9279564 /src | |
parent | 17c361a5e472b2ae80ed93080106e31b22f8e22a (diff) | |
download | craftbukkit-5fe9ac362b7e65721a9d31b1c366d7b92da877f7.tar craftbukkit-5fe9ac362b7e65721a9d31b1c366d7b92da877f7.tar.gz craftbukkit-5fe9ac362b7e65721a9d31b1c366d7b92da877f7.tar.lz craftbukkit-5fe9ac362b7e65721a9d31b1c366d7b92da877f7.tar.xz craftbukkit-5fe9ac362b7e65721a9d31b1c366d7b92da877f7.zip |
implementations of the playSound methods
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 33c7a955..149852cd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -11,6 +11,7 @@ import java.util.Random; import net.minecraft.server.*; import org.bukkit.entity.Arrow; +import org.bukkit.Sound; import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.event.weather.ThunderChangeEvent; import org.bukkit.event.world.SpawnChangeEvent; @@ -641,5 +642,25 @@ public class CraftWorld implements World { public void setPVP(boolean pvp) { world.pvpMode = pvp; + } + + public void playSound(Player player, Sound sound, int data) { + playSound(player.getLocation(), sound, data, 0); + } + + public void playSound(Location location, Sound sound, int data) { + playSound(location, sound, data, 64); } + + public void playSound(Location location, Sound sound, int data, int radius) { + int packetData = sound.getSoundIdentifier(); + Packet61 packet = new Packet61(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data); + int distance; + for (Player player : getPlayers()) { + distance = (int) player.getLocation().distanceTo(location); + if (distance <= radius) { + ((CraftPlayer) player).getHandle().netServerHandler.sendPacket(packet); + } + } + } } |