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 aMusicInstrumentBuilder
with a newMaterial.GOAT_HORN
.MusicInstrumentBuilder
(@NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aMusicInstrumentBuilder
using an existingItemStack
. -
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.MusicInstrument
Gets the music instrument of the goat horn.boolean
Checks 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 aMusicInstrumentBuilder
with a newMaterial.GOAT_HORN
. -
MusicInstrumentBuilder
public MusicInstrumentBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aMusicInstrumentBuilder
using 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
- theMusicInstrument
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
-