From 1e6a141afbb0126133468c6ce1e3054e4b2d4933 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 19 Jul 2013 15:21:50 -0400 Subject: [PATCH] Add raw sound string playSound method. Adds BUKKIT-2443 A method has been added to Player which allows the server to send a sound string to the client. Assuming the client has the specified sound, it will be played. This is needed by the implementation of the /playsound command. By: h31ix --- .../java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index fd7385663a..02c7b8a892 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -259,13 +259,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void playSound(Location loc, Sound sound, float volume, float pitch) { + playSound(loc, CraftSound.getSound(sound), volume, pitch); + } + + public void playSound(Location loc, String sound, float volume, float pitch) { if (loc == null || sound == null || getHandle().playerConnection == null) return; double x = loc.getBlockX() + 0.5; double y = loc.getBlockY() + 0.5; double z = loc.getBlockZ() + 0.5; - Packet62NamedSoundEffect packet = new Packet62NamedSoundEffect(CraftSound.getSound(sound), x, y, z, volume, pitch); + Packet62NamedSoundEffect packet = new Packet62NamedSoundEffect(sound, x, y, z, volume, pitch); getHandle().playerConnection.sendPacket(packet); }