[SPIGOT-6174] Add jukebox interact event Created: 09/Oct/20 Updated: 14/Oct/20 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | Priority: | Minor |
Reporter: | FESTINO | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | event, jukebox |
Version: | any |
Guidelines Read: | Yes |
Description |
It is difficult to cancel the disc playing at the moment of its insertion, and when canceling later, for some reason the playback does not stop (probably a vanilla bug). As a result, now I see 2 ways to undo a record playing: Therefore, I propose to introduce events related to insertion and removal of discs. On inserting, the event will fire before a packet is created, and if the event is canceled, a packet will not be sent. Also, it's hard to work with jukeboxes at the moment, as Jukebox#stopPlaying() doesn't even change the state of Jukebox#isPlaying() for some reason. |
Comments |
Comment by FESTINO [ 14/Oct/20 ] |
But the start playing event will still be perfect for me. I want the record to be inserted inside the jukebox without playing. More specifically, I am developing a plugin that allows to record notes on records and playing them from a jukebox. If I do Jukebox#setRecord(not null ItemStack), then it immediately automatically plays (I already use this in another feature of the plugin, which restarts the jukebox when the redstone powered it). And in general, it is more convenient to check which record is trying to start playing than to check which block is clicked, which item is in the hand, is there already a record in the jukebox, etc. (I can't even name all the checks right away) |
Comment by HexedHero [ 14/Oct/20 ] |
InteractEvent is perfectly fine for this. Just check for any Right Clicks.
Also for the Jukebox stopPlaying you can do jukeboxState.setPlaying(null); jukeboxState.update();
|