Solved Stopping playing music disk

Discussion in 'Plugin Development' started by I Al Istannen, May 26, 2016.

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

    I Al Istannen

    Hey,

    I am currently trying to make some kind of music plugin, which should have the ability to stop a running disk. The code for starting is quite easy:
    Code:
    player.playEffect(player.getLocation(), Effect.RECORD_PLAY, disk.getMaterial());
    where disk.getMaterial() is the Material of the disk. Like "Material.GOLD_RECORD".

    This works fine for playing disks, but not for stopping. I searched around for a while and found some other plugins working with jukeboxes. One of them just used the jukebox methods (is nearly the same as below, Just with Material.AIR instead of 0), which I can't and the other used this:
    Code:
    player.playEffect(location, Effect.RECORD_PLAY, 0);
    This with Material (as this method is deprecated) throws an error for AIR:
    Fair enough, I guess.
    Sadly you don't have better luck with "0". It just does nothing.

    Do you have any idea if it is possible? Is this entirely client-side?
    On wiki.vg, "Record" is mentioned a few times, but only in conjunction with the method above. "Stop" is found a bit more often, but still not where I need it to be. Maybe I have skipped something though.

    I would really appreciate an answer, so feel free to ;)

    EDIT: On the javadocs for Jukebox it says:
    Neither of which seems to work with the playEffect method, sadly.


    After toying around a bit with ProtocolLib, the packet send from removing a disk from a JukeBox is a WorldEvent one (the same as the PlayEffect) with a data value of 0. So you have "better luck" with 0. I just didn't realize it.
     
    Last edited: May 28, 2016
Thread Status:
Not open for further replies.

Share This Page