Player.stopSound() just not working at all.

Discussion in 'Plugin Development' started by Tim_M, Feb 16, 2022.

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

    Tim_M

    I'm just trying to stop the sound "MUSIC_DISC_OTHERSIDE".
    I have tried:
    Code:
    player.stopSound(Sound.MUSIC_DISC_OTHERSIDE);
    But no matter how I tried it: delayed, with the other arguments, it never did anything at all.

    Currently I have a work around:
    Code:
    Bukkit.getServer().dispatchCommand(Main.instance.console, "minecraft:stopsound " + player.getName() + " record " + sound.getKey());
    
    this will properly stop the sound, but it's kind of a terrible solution, does anyone have any ideas? Is the stopSound method just broken?

    Edit: I made some discoveries that points to this being a flaw of the Bukkit API but I can't confirm. If I play a sound using world.playSound() then using player.stopSound() doesn't work, just like with the music from a jukebox, and World doesnt have a stopSound method so it doesn't seem possible to stop (maybe with packets tho).
     
    Last edited: Feb 16, 2022
  2. Offline

    KarimAKL

    @Tim_M I don't know why it doesn't work, but you could try comparing the source code for the #stopSound method and the /stopsound command.
     
Thread Status:
Not open for further replies.

Share This Page