Filled StopSound

Discussion in 'Plugin Requests' started by adi0115, Aug 13, 2019.

Thread Status:
Not open for further replies.
  1. Plugin category: Misc

    Minecraft version: 1.8.8

    Suggested name: SoundStop

    What I want: I'm using a custom resource pack for my server and I have sound/jukebox records that I want to stop when a player for example walks away or enters a region ect. From doing some research, there's no way to stop sounds when they start playing in vanilla. For example I have a replaced sound for GHAST_DEATH that is 10 seconds long and I would like to cancel it whenver I want. So I'm looking for a simple plugin that will cancel specific sound or all sounds that the player is currently hearing, incase for example player is hearing a jukebox record and GHAST_DEATH at the same time and I want to cancel both. From doing some research, I found this thread that may help and this code snippet:
    Code:
    Player player = (Player) sender;
                PacketPlayOutNamedSoundEffect p = new PacketPlayOutNamedSoundEffect(args[1], 0, 0, 0, Float.MAX_VALUE, 1);
                ((CraftPlayer)player).getHandle().playerConnection.sendPacket(p);
    Ideas for commands:
    /stopsound all - stops all sounds that the player is hearing
    /stopsound <name> - cancels specific sound player is hearing for example /stopsound ENDERMAN_STARE or /stopsound WITHER_SPAWN

    Ideas for permissions: stopsound.use - allows to use any /stopsound commands

    When I'd like it by: This week
     
  2. Offline

    Twisted_Panda

    Is this only for 1.8.8? Future versions have a built in method within the API
     
  3. Yes, this is only for 1.8.8 and I'm aware of the method in the future API, I believe it was introduced in 1.10 but I'm looking for a way to do this on 1.8.8 and I found code snippets that apperently another people used and it worked so I'm looking if someone who can archieve the same.
     
  4. Offline

    Twisted_Panda

    That method is for sending sounds
    I mean I can make something but it'll depend on ProtocolLib
     
  5. @Twisted_Panda That's find by me, I'm pretty desperate at this point since this is a game changer for me unless I update to 1.10+ which wouden't work for me in this situation and I think I'm using ProtocolLib anyway.
     
  6. Offline

    Twisted_Panda

    I'll be home in a couple of days and I'll get it done for you unless someone else does in the meantime
     
  7. Offline

    Twisted_Panda

    Wanted to give you an update, not to leave you hanging. Got the essentials done, everything works in order. Do you want to have a config to save the canceled sounds?


    DOWNLOAD:
    https://www.dropbox.com/s/kg5rh33yokfriv2/mStopSound-1.0.0.jar?dl=0

    Permissions:
    stopsound.use

    Commands:
    /stopsound all
    /stopsound list <View disabled sounds>
    /stopsound <soundName>

    Message me or reply back if you find something that's not working right!


    SOUNDS:
    https://pastebin.com/cfPe8Y46
    Example: /stopsound pig.say
    No need for the mob. part

    MAKE SURE TO HAVE ProtocolLib
     
    Last edited: Aug 18, 2019
  8. @Twisted_Panda Thank you for doing this request. I have tested it and it does indeed stop the sound from playing but doesn't cancel already playing sounds. Also, would it be possible to do it via player? For example /stopsound pig.say Notch?
     
  9. Offline

    Twisted_Panda

    It doesn't cancel already playing sounds because ProtocolLib only allows me to check before the sound is sent and not in play. Maybe there's a workaround to it, but I have not checked. I can do the second part if you'd like. Any updates will be posted at https://dev.bukkit.org/projects/stop-sounds so check it out I'll get on it when I have time!
     
  10. @Twisted_Panda Thanks, I have asked people about this about a month ago regarding cancelling already playing sounds to player on 1.8.8, the only answer I got was to try and see if sending a fake respawn packet would work. Maybe you could give it a go and see if that's possible?
     
Thread Status:
Not open for further replies.

Share This Page