From ef13ca4444c53ec5fd844ab078c7dcbf0e1f0bbe Mon Sep 17 00:00:00 2001 From: Lukas Hennig Date: Fri, 4 Mar 2016 15:55:40 +1100 Subject: [PATCH] SPIGOT-1549: Fix custom String sounds. --- .../org/bukkit/craftbukkit/entity/CraftPlayer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0f9eeb966f..303da2d061 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); }