SPIGOT-1549: Fix custom String sounds.

This commit is contained in:
Lukas Hennig 2016-03-04 15:55:40 +11:00 committed by md_5
parent 7863085a62
commit ef13ca4444

View file

@ -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);
}