Solved ProtocolLib or NMS, remove sound from effect

Discussion in 'Plugin Development' started by rasm945i, Oct 4, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    rasm945i

    Hello there

    I made a plugin which gives players effects, but some of those effects make some awful noises nobody can listen to for a few minutes. Mainly its Effect.DRAGON_BREATH which is noisy.
    I have googled quite a lot, but havent found anything i understood or could modify for my needs. Ive been a few places, but all of the places i either didnt understand what i read, knew what to look for, or how to use it. Heres a few places:

    https://bukkit.org/threads/lib-1-7-...sily-modify-sent-and-recieved-packets.101035/
    https://bukkit.org/threads/help-explosion-effect-without-damage-or-sound.171371/#post-1828630 (sound still was there, damage was gone)
    https://bukkit.org/threads/removing-sounds-with-protocollib.264402/ (I tried printing event.getPacket().getStrings().read(0); but i never got any information, it never printed)
    http://wiki.vg/Protocol

    If you can send me some examples or links that can explain it to me, i would really appreciate it.
    Im using Spigot 1.10.2 when compiling, and running it on a Paper 1.10.2 server, in case thats useful information.

    Thanks for any help in advance :)
     
  2. @rasm945i
    I think this would become rather tedious. What I instead recommend is, figure out which of the effects make sounds, and instead of just playing them with the normal method, try to manually send just the visual packet, and not the sound.
     
  3. Offline

    rasm945i

    @AlvinB
    I believe i read that somewhere else, but im a retard at packets, i dont understand any of it. Do you have any tutorials or some other useful information on that? xD

    EDIT: Do you know if p.getWorld().spawnParticle(); has sound?

    EDIT AGAIN: It doesnt seem to have sound, it fixed my problem :p
     
    Last edited: Oct 4, 2016
  4. @rasm945i
    Actually, forget what I said about packets, I just remembered that you can instead of playing it as an Effect, play it as a particle. You can just do this:
    Code:java
    1. player.getWorld().spawnParticle(particleType, location, amountOfParticles);
    with particleType being a particle from the Particle enum, location being the location you want to spawn it at, and amountOfParticles being an int representing the number of particles you want to be spawned. If we adapt this to Dragon Breath, it'd look something like this:
    Code:java
    1. player.getWorld().spawnParticle(Particle.DRAGON_BREATH, player.getLocation(), 100);
    which would roughly replicate the dragon breath effect (You may want to tinker around with the particle amount to make it look more like the original effect) without sound.
     
Thread Status:
Not open for further replies.

Share This Page