How to get minecraft sound name instead of bukkit Sound enum
chrisrnj opened this issue ยท 1 comments
Make sure you're doing the following
- You're using the latest build for your server version
- This isn't an issue caused by another plugin
- You've checked for duplicate issues
- You didn't use
/reload
Describe the question
When checking for the packet NAMED_SOUND_EFFECT, I can get the bukkit Sound enum with #getSoundEffects(), however, is there a way to get the minecraft sound name, instead of the enum?
API method(s) used
ProtocolLibrary#getProtocolManager()
ProtocolManager#addPacketListener()
PacketAdapter#onPacketSending()
PacketEvent#getSoundEffects()
Expected behavior
The sound name from minecraft sound list, instead of bukkit Sound enum.
Code
protocolManager.addPacketListener(
new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.NAMED_SOUND_EFFECT) {
@Override
public void onPacketSending(PacketEvent event) {
// Prints bukkit Sound enum
System.out.println(event.getPacket().getSoundEffects().read(0).name());
}
});