Class MusicInstrumentBuilder
java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.MusicInstrumentBuilder
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 Summary
ConstructorsConstructorDescriptionConstructs aMusicInstrumentBuilderwith a newMaterial.GOAT_HORN.MusicInstrumentBuilder(@NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aMusicInstrumentBuilderusing an existingItemStack. -
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.MusicInstrumentGets the music instrument of the goat horn.booleanChecks if the goat horn has a music instrument set.setInstrument(@NotNull org.bukkit.MusicInstrument instrument) Sets the music instrument of the goat horn.Methods inherited from class io.github.lucfr1746.llibrary.itemstack.ItemBuilder
addAttributeModifier, addEnchant, addEnchant, addEnchant, addItemFlags, addLore, build, getAmount, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCustomModelData, getDamageResistant, getDisplayName, getEnchantable, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getEquippableComponent, getFoodComponent, getItemFlags, getItemMeta, getItemModel, getJukeboxPlayableComponent, getMaxStackSize, getRarity, getToolComponent, getTooltipStyle, getTranslationKey, getType, getUseCooldownComponent, getUseRemainder, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasDamageResistant, hasEnchant, hasEnchantable, hasEnchantmentGlintOverride, hasEnchants, hasEquippableComponent, hasFoodComponent, hasItemFlag, hasItemModel, hasJukeboxPlayableComponent, hasMaxStackSize, hasRarity, hasToolComponent, hasTooltipStyle, hasUseCooldownComponent, hasUseRemainder, hideAllItemFlags, insertLore, isGlider, isHideTooltip, isUnbreakable, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchants, removeItemFlags, replaceLore, setAmount, setAttributeModifiers, setCustomModelData, setDamageResistant, setDisplayName, setEnchantable, setEnchantmentGlintOverride, setEquippableComponent, setEquippableComponent, setFood, setFoodComponent, setGlider, setHideTooltip, setItemModel, setItemModel, setJukeboxPlayableComponent, setJukeboxPlayableComponent, setJukeboxPlayableComponent, setLores, setLores, setMaxStackSize, setRarity, setToolComponent, setToolComponent, setTooltipStyle, setTooltipStyle, setType, setUnbreakable, setUseCooldownComponent, setUseCooldownComponent, setUseCooldownComponent, setUseRemainder
-
Constructor Details
-
MusicInstrumentBuilder
public MusicInstrumentBuilder()Constructs aMusicInstrumentBuilderwith a newMaterial.GOAT_HORN. -
MusicInstrumentBuilder
public MusicInstrumentBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aMusicInstrumentBuilderusing an existingItemStack.- Parameters:
itemStack- the item stack to modify- Throws:
IllegalArgumentException- if the item's meta is not an instance ofMusicInstrumentMeta
-
-
Method Details
-
setInstrument
public MusicInstrumentBuilder setInstrument(@NotNull @NotNull org.bukkit.MusicInstrument instrument) Sets the music instrument of the goat horn.- Parameters:
instrument- theMusicInstrumentto set- Returns:
- this
MusicInstrumentBuilderinstance 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
-