Preventing sound playback with ProtocolLib

Discussion in 'Spigot Plugin Help' started by Isto, Jul 12, 2019.

  1. Hello,

    The title is quite explicit: I would like to prevent the playback of a sound with ProtocolLib. I found an old piece of code but unfortunately it is no longer up to date.

    I'll give it to you in case it gives you any leads:

    Code (Java):
    @Override
    public void onEnable() {
        final ProtocolManager manager = ProtocolLibrary.getProtocolManager();
        manager.addPacketListener(
                new PacketAdapter(this, ConnectionSide.SERVER_SIDE,
                    Packet3ENamedSoundEffect.ID) {
                        @Override
                        public void onPacketSending(PacketEvent event) {
                            Packet3ENamedSoundEffect named = new Packet3ENamedSoundEffect(event.getPacket());
                            // Just rename all zombie sounds to skeleton sounds
                            named.setSoundName(named.getSoundName().replace("HURT_FLESH", "ARROW.HIT"));
                        }
                });
    }
    Thank you in advance,
    Isto
     
  2. I'm really sorry to have to do this but I up the discussion. She's slightly drowning. :|