From ef13ca4444c53ec5fd844ab078c7dcbf0e1f0bbe Mon Sep 17 00:00:00 2001 From: Lukas Hennig Date: Fri, 4 Mar 2016 15:55:40 +1100 Subject: SPIGOT-1549: Fix custom String sounds. --- src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0f9eeb96..303da2d0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -296,17 +296,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void playSound(Location loc, Sound sound, float volume, float pitch) { - if (sound == null) { - return; - } - playSound(loc, CraftSound.getSound(sound), volume, pitch); + if (loc == null || sound == null || getHandle().playerConnection == null) return; + + PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect(CraftSound.getSound(sound)), SoundCategory.MASTER, loc.getX(), loc.getY(), loc.getZ(), volume, pitch); + getHandle().playerConnection.sendPacket(packet); } @Override public void playSound(Location loc, String sound, float volume, float pitch) { if (loc == null || sound == null || getHandle().playerConnection == null) return; - PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect(sound), SoundCategory.MASTER, loc.getX(), loc.getY(), loc.getZ(), volume, pitch); + PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(sound, SoundCategory.MASTER, loc.getX(), loc.getY(), loc.getZ(), volume, pitch); getHandle().playerConnection.sendPacket(packet); } -- cgit v1.2.3