Missing new 1.12 sound names
LadyCailinBot opened this issue · 11 comments
CMDHELPER-3154 - Reported by Алексей.Положенцев
A bunch of new sounds, including new instruments in play_note() and play_sound() (xylophone, bell, flute, chime, guitar)
Comment by PseudoKnight
Okay, a little background to what's happening here. In 1.9 Mojang changed all the sound names. The Spigot team then decided to change all their ENUM names to match. In general it's a more organized format, but it broke any plugins that used the old sounds. At that point I decided to minimize script breakage and maintain backwards compatibility with older server versions by mapping our ENUM (which matched Bukkit's) to their new ENUM, preserving the old sound names in scripts. Any new sounds were still accessible via play_named_sound(), which change on the whim of Mojang. The new sounds are also still accessible via play_sound(), just by their new Bukkit names, which currently match Mojang's sound names except instead of "." you'd have "_". (eg. block.enchantment_table.use and BLOCK_ENCHANTMENT_TABLE_USE)
So, no, the new sounds aren't missing (except from the wiki), but this still needs to be updated to support the new versions of the same sounds that are in the old ENUM. And there still needs to be some backwards compatibility here.
Comment by PseudoKnight
Oh, as for play_note(), I've already added all the instruments there. You can see them in the note_play event. What you've stumbled upon is a bug in Craftbukkit. It outputs an error in log. Going there shows that it's missing support for the new sounds in playNote().
java.lang.IllegalArgumentException: Sound effect block.note.null does not exist
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:191)
at org.bukkit.craftbukkit.v1_12_R1.CraftSound.getSoundEffect(CraftSound.java:575)
at org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer.playNote(CraftPlayer.java:395)
at com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer.playNote(BukkitMCPlayer.java:506)
at com.laytonsmith.core.functions.Environment$play_note.exec(Environment.java:920)
Comment by PseudoKnight
I submitted an issue on their tracker so that this can be fixed in Spigot.
Comment by Алексей.Положенцев
Weird, but play_note() is silent then you turn off "Music" volume in options. Note blocks works well in the same time.
'Pling' in play_note() instrument now gives FormatException error
New instrument sound are still not available through play_sound() ("Sound name is invalid"). Tried both "XYLOPHONE" (as note_play() event returns) and "NOTE_XYLOPHONE" variants.
Using freshest Spigot and CH.
Comment by PseudoKnight
I'm not sure what you mean by the first couple sentences, but I should note that "PLING" is not an instrument name. These are the instrument names: PIANO, BASS_DRUM, SNARE_DRUM, STICKS, BASS_GUITAR, FLUTE, BELL, GUITAR, CHIME, XYLOPHONE. Also, the sound name for XYLOPHONE is BLOCK_NOTE_XYLOPHONE (or block.note.xylophone if using play_named_sound()). The new sounds follow the vanilla sound name structure.
There's some confusion because the wiki.sk89q.com API hasn't been generated again since the instrument list was changed, but the internal documentation has been changed and this is reflected in the in-development website: https://methodscript.com/docs/3.3.2/API/functions/play_note
Comment by Алексей.Положенцев
Oh, it's really just a confusion, sorry...
What i meant: Go in "Options" -> "Music and Sounds" and turn off only "Music", not "Master Volume". All sounds from play_note() will be muted... (but vanilla note blocks will still work and sound fine)
Comment by PseudoKnight
Oh, really? That might be a Spigot bug. They may have mistakenly put it on the music category. playNote in Bukkit is not a really well-supported or often-used feature. I'll take a look and send them the information if it's in error.
Comment by PseudoKnight
So I was able to confirm the bug in-game, but not in-code. I have no idea why that is happening because in-code it clearly mentions the RECORDS category. It might be a packet issue. The best I can do is tell them it is happening.
Comment by Алексей.Положенцев
Also, play_sound() list of sounds in wiki contains 'UNKNOWN' sound. It gives FormatException: Sound name 'unknown' is invalid.
Comment by PseudoKnight
That's used internally for new sounds that don't have a CH "name" for that sound. Not sure if there's simple a way to exclude that from the wiki or even if it's ultimately necessary. I do know that it's excluded from your internal docs on the server, though, if you use a command or something to print those to your screen.