From a6b85ac332351a1f00f53d0343771d03924a156a Mon Sep 17 00:00:00 2001 From: Parker Hawke Date: Wed, 29 Mar 2023 19:23:37 +1100 Subject: [PATCH] #835: Add Jukebox#hasRecord() and #startPlaying(), clarify #setRecord() --- src/main/java/org/bukkit/block/Jukebox.java | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/block/Jukebox.java b/src/main/java/org/bukkit/block/Jukebox.java index 337fc4a5..fa76b2a4 100644 --- a/src/main/java/org/bukkit/block/Jukebox.java +++ b/src/main/java/org/bukkit/block/Jukebox.java @@ -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. + *

+ * 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. */