Class MusicInstrumentBuilder

java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.MusicInstrumentBuilder

public class MusicInstrumentBuilder extends ItemBuilder
The MusicInstrumentBuilder class extends ItemBuilder to provide additional functionality for modifying MusicInstrumentMeta of an ItemStack. This class allows setting the instrument for goat horns.
  • Constructor Details

    • MusicInstrumentBuilder

      public MusicInstrumentBuilder()
      Constructs a MusicInstrumentBuilder with a new Material.GOAT_HORN.
    • MusicInstrumentBuilder

      public MusicInstrumentBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Constructs a MusicInstrumentBuilder using an existing ItemStack.
      Parameters:
      itemStack - the item stack to modify
      Throws:
      IllegalArgumentException - if the item's meta is not an instance of MusicInstrumentMeta
  • Method Details

    • setInstrument

      public MusicInstrumentBuilder setInstrument(@NotNull @NotNull org.bukkit.MusicInstrument instrument)
      Sets the music instrument of the goat horn.
      Parameters:
      instrument - the MusicInstrument to set
      Returns:
      this MusicInstrumentBuilder instance for chaining
      Throws:
      IllegalArgumentException - if the instrument is null
    • getInstrument

      @Nullable public @Nullable org.bukkit.MusicInstrument getInstrument()
      Gets the music instrument of the goat horn.
      Returns:
      the current MusicInstrument, or null if none is set
    • hasInstrument

      public boolean hasInstrument()
      Checks if the goat horn has a music instrument set.
      Returns:
      true if an instrument is set, false otherwise