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