SPIGOT-1549: Fix custom String sounds.

By: Lukas Hennig <lukas@wirsindwir.de>
This commit is contained in:
CraftBukkit/Spigot
2016-03-04 15:55:40 +11:00
parent 2e03112d2d
commit 3cb5dd22bb

View File

@@ -296,17 +296,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void playSound(Location loc, Sound sound, float volume, float pitch) { public void playSound(Location loc, Sound sound, float volume, float pitch) {
if (sound == null) { if (loc == null || sound == null || getHandle().playerConnection == null) return;
return;
} PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect(CraftSound.getSound(sound)), SoundCategory.MASTER, loc.getX(), loc.getY(), loc.getZ(), volume, pitch);
playSound(loc, CraftSound.getSound(sound), volume, pitch); getHandle().playerConnection.sendPacket(packet);
} }
@Override @Override
public void playSound(Location loc, String sound, float volume, float pitch) { public void playSound(Location loc, String sound, float volume, float pitch) {
if (loc == null || sound == null || getHandle().playerConnection == null) return; 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); getHandle().playerConnection.sendPacket(packet);
} }