Solved Lightning Bolt Sound

Discussion in 'Plugin Development' started by TheGamblingMan, Aug 22, 2014.

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

    TheGamblingMan

    Hey
    Is there a way to remove the Sound of the lightning?
    Or is it possible to reduce the volume of the lightning?

    :)
     
  2. Offline

    Onlineids

    TheGamblingMan You could add protocallib as a dependency and add a new packet listener that listens for when the lightning sound goes off.
     
  3. Offline

    TheGamblingMan

    Ok is there a tutorial how i can use protocoll lib? Because the tutorial for developer on the Download Page doesn't worke

    Edit: My fail the tutorial works and in the tutorial is also something to block all sounds but how can i say what sound should be blocked?

    Edit: Onlineids
    Ok i found a way to block a single sound but

    it block's this
    Code:java
    1. p.getWorld().playSound(p.getLocation(), Sound.AMBIENCE_THUNDER,
    2. 1.0f, 1.0f);


    but the sound of this
    Code:java
    1. loc.getWorld().strikeLightningEffect(loc);


    is still there
     
  4. Offline

    Onlineids

    TheGamblingMan Your playing the sound....then wondering why you hear it?
     
  5. Offline

    BillyGalbreath

    Thats because the first method the server is sending a sound packet to the client. ProtocolLib intercepts that and cancels it, thus no sound is ever played. Working as intended.

    The second one you are not sending a sound packet to the client. Instead, you are telling the client to play an effect (lightning) which you didnt setup any packet intercepts for that effect so it slips by. The client, on its own doing, plays the associated sound with that effect not because the server told it to but because thats the sound that goes with the effect and its hard coded into the client.
     
  6. Offline

    TheGamblingMan

    BillyGalbreath
    Ok thanks but is there a way that i can block the sound of the strikelightningEffect?
     
  7. Offline

    molenzwiebel

    Don't think so. The sound is played client-side when it gets notified of a lightning spawn
     
  8. Offline

    TheGamblingMan

    But when i block all Soundpackets the sound of the effect also doesn't play
     
  9. Offline

    BillyGalbreath

    If thats the case, why dont you setup a sniffer to debug all sound packets to console output when they are played. Then fire your effect. Then you will know what sound packets are being sent to the client, and thus which ones to block.
     
  10. Offline

    TheGamblingMan

    BillyGalbreath thanks :)

    Now a other question is it possible to make a radius and in that you can hear a sound but if you go out you don't hear it any more?
     
  11. Offline

    BillyGalbreath

    Thats what volume is for. The higher the volume, the farther away you can be and still hear it.
     
  12. Offline

    TheGamblingMan

    Ok
    How can i send a Packet with the sound i wabt and change the volum? Because i can't block the sound of zhe effect and not when i send the sound

    Thanks for the help i found a seloution :)
     
  13. Offline

    BillyGalbreath

    You should post your solution here so people that Google search this problem and come here will be able to view the solution and not be left hanging. ;)
     
  14. Offline

    TheGamblingMan

    I don't want to post my code here but i can say how i made it. I made a listener with protocoll lib and than i looked if the player is in a worldguard region and if he is than i send him the soundpackeg and if he isn't i canceld the event
     
Thread Status:
Not open for further replies.

Share This Page