#835: Add Jukebox#hasRecord() and #startPlaying(), clarify #setRecord()

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
Bukkit/Spigot 2023-03-29 19:23:37 +11:00
parent 576f627798
commit fc1538ac4d

View File

@ -27,6 +27,18 @@ public interface Jukebox extends TileState, BlockInventoryHolder {
*/
public void setPlaying(@Nullable Material record);
/**
* Gets whether or not this jukebox has a record.
* <p>
* A jukebox can have a record but not {@link #isPlaying() be playing}
* if it was stopped with {@link #stopPlaying()} or if a record has
* finished playing.
*
* @return true if this jukebox has a record, false if it the jukebox
* is empty
*/
public boolean hasRecord();
/**
* Gets the record item inserted into the jukebox.
*
@ -36,7 +48,7 @@ public interface Jukebox extends TileState, BlockInventoryHolder {
public ItemStack getRecord();
/**
* Sets the record being played.
* Sets the record being played. The jukebox will start playing automatically.
*
* @param record the record to insert or null/AIR to empty
*/
@ -49,6 +61,14 @@ public interface Jukebox extends TileState, BlockInventoryHolder {
*/
public boolean isPlaying();
/**
* Starts the jukebox playing if there is a record.
*
* @return true if the jukebox had a record and was able to start playing, false
* if the jukebox was already playing or did not have a record
*/
public boolean startPlaying();
/**
* Stops the jukebox playing without ejecting the record.
*/