[SPIGOT-1549] Playing Custom Sounds from Resource Packs Causes Error Created: 01/Mar/16  Updated: 04/Mar/16  Resolved: 04/Mar/16

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Nathan Wolf Assignee: Unassigned
Resolution: Fixed Votes: 3
Labels: 1.9
Environment:

Spigot 1.9



 Description   

Using the deprecated playSound(String...) method to play custom sounds via a resource pack worked in 1.8, but causes an error in 1.9:

Caused by: java.lang.IllegalArgumentException: Sound effect magic.wandup does not exist

I was previously able to use playSound with the string "magic.wandup" to play that sound as defined in a server resource pack.

Is there any way to make that work again?

Relates (loosely) to SPIGOT-251 and SPIGOT-1528



 Comments   
Comment by blablubbabc [ 02/Mar/16 ]

Pull request which fixes this can be found here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/196/

Comment by Johnny Joannou [ 01/Mar/16 ]

Temporary workaround:

public static void playSound(Player player, String sound, float volume, float pitch)
{
    PacketPlayOutCustomSoundEffect soundPacket = new PacketPlayOutCustomSoundEffect(sound, SoundCategory.MASTER, player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), volume, pitch);

    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(soundPacket);
}
Comment by Johnny Joannou [ 01/Mar/16 ]

I'm also getting this, driving me crazy.
Used to be able to supply a string that would get passed along, but it's trying to parse that into the new enums or something now?

Comment by Daniel Mills [ 01/Mar/16 ]

I'm not getting any exceptions thrown, however, the sounds do not play at all. It may possibly be that the resource pack sound structure has changed.

If you load a resource pack into 1.9 on the resource packs menu, you can see them blood red, mentioning they are incompatible.

Generated at Fri Mar 21 18:09:01 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.