程序包 org.bukkit.block

# 接口 Jukebox

所有超级接口:
  `BlockInventoryHolder`, `BlockState`, `InventoryHolder`, `Metadatable`, `PersistentDataHolder`, `TileState`

public interface Jukebox extends TileState, BlockInventoryHolder
代表唱片机.

- ## 方法概要

  修饰符和类型
  方法
  说明
  `boolean`
  `eject()`
  停止唱片机的播放,并弹出唱片.
  `@NotNull JukeboxInventory`
  `getInventory()`
  获取该对象的用户界面项目.
  `@NotNull Material`
  `getPlaying()`
  获取插入该唱片机的唱片.
  `@NotNull ItemStack`
  `getRecord()`
  获取插入该唱片机的唱片 (译注:这是较新版本才有的API, 建议使用getPlaying).
  `@NotNull JukeboxInventory`
  `getSnapshotInventory()`
  `boolean`
  `hasRecord()`
  Gets whether or not this jukebox has a record.
  `boolean`
  `isPlaying()`
  检查唱片机是否正在播放唱片.
  `void`
  `setPlaying(@Nullable Material record)`
  设置将要播放的唱片.
  `void`
  `setRecord(@Nullable ItemStack record)`
  设置将要播放的唱片, 唱片机将自动播放.
  `boolean`
  `startPlaying()`
  Starts the jukebox playing if there is a record.
  `void`
  `stopPlaying()`
  使唱片机停止播放, 但不弹出唱片.

  ### 从接口继承的方法 org.bukkit.inventory.BlockInventoryHolder

  `getBlock`

  ### 从接口继承的方法 org.bukkit.block.BlockState

  `copy, copy, getBlock, getBlockData, getChunk, getData, getLightLevel, getLocation, getLocation, getRawData, getType, getWorld, getX, getY, getZ, isPlaced, setBlockData, setData, setRawData, setType, update, update, update`

  ### 从接口继承的方法 org.bukkit.metadata.Metadatable

  `getMetadata, hasMetadata, removeMetadata, setMetadata`

  ### 从接口继承的方法 org.bukkit.block.TileState

  `getPersistentDataContainer`

- ## 方法详细资料

  - ### getPlaying

    @NotNull @NotNull Material getPlaying()
    获取插入该唱片机的唱片.

    原文: Gets the record inserted into the jukebox.

    返回:
      这个唱片物品,如果返回AIR就表示唱片机内无唱片插入

  - ### setPlaying

    void setPlaying(@Nullable @Nullable Material record)
    设置将要播放的唱片.

    原文: Sets the record being played.

    参数:
      `record` - 这个唱片物品,设置为AIR/null则停止播放

  - ### hasRecord

    boolean hasRecord()
    Gets whether or not this jukebox has a record.

    A jukebox can have a record but not `be playing` if it was stopped with `stopPlaying()` or if a record has finished playing.

    返回:
      true if this jukebox has a record, false if it the jukebox is empty

  - ### getRecord

    @NotNull @NotNull ItemStack getRecord()
    获取插入该唱片机的唱片 (译注:这是较新版本才有的API, 建议使用getPlaying).

    原文:Sets the record being played.

    返回:
      唱片物品堆副本,如果返回空气物品堆(本方法不会返回null)就表示唱片机内无唱片插入

  - ### setRecord

    void setRecord(@Nullable @Nullable ItemStack record)
    设置将要播放的唱片, 唱片机将自动播放. (译注:这是较新版本才有的API, 建议使用setPlaying).

    原文:Sets the record being played. The jukebox will start playing automatically.

    参数:
      `record` - 这个唱片物品,设置为AIR/null则停止播放

  - ### isPlaying

    boolean isPlaying()
    检查唱片机是否正在播放唱片.

    原文: Checks if the jukebox is playing a record.

    返回:
      返回true就表示唱片正在播放

  - ### startPlaying

    boolean startPlaying()
    Starts the jukebox playing if there is a record.
    返回:
      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

  - ### stopPlaying

    void stopPlaying()
    使唱片机停止播放, 但不弹出唱片.

    原文:Stops the jukebox playing without ejecting the record.

  - ### eject

    boolean eject()
    停止唱片机的播放,并弹出唱片.

    如果这个方块不再是一个唱片机, 那么使用本方法将没有任何效果并返回false.

    原文: Stops the jukebox playing and ejects the current record.

    If the block represented by this state is no longer a jukebox, this will do nothing and return false.

    返回:
      true表示已弹出唱片;false表示唱片机没有播放唱片
    抛出:
      `IllegalStateException` - 如果方块状态未应用(译注:仅仅是一种表示而未应用到实际的方块上, 一种虚拟状态)

  - ### getInventory

    @NotNull @NotNull JukeboxInventory getInventory()
    从接口复制的说明: `InventoryHolder`
    获取该对象的用户界面项目.

    原文:Get the object's inventory.

    指定者:
      `getInventory` 在接口中 `InventoryHolder`
    返回:
      inventory
    另请参阅:
      - `Container.getInventory()`

  - ### getSnapshotInventory

    @NotNull @NotNull JukeboxInventory getSnapshotInventory()
    返回:
      snapshot inventory
    另请参阅:
      - `Container.getSnapshotInventory()`