Package net.tnemc.item.bukkit
Class BukkitItemStack
java.lang.Object
net.tnemc.item.bukkit.BukkitItemStack
- All Implemented Interfaces:
Cloneable
,AbstractItemStack<org.bukkit.inventory.ItemStack>
public class BukkitItemStack
extends Object
implements AbstractItemStack<org.bukkit.inventory.ItemStack>
BukkitItemStack
- Since:
- 0.2.0.0
- Author:
- creatorfromhell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
amount()
The quantity of the item stack.amount
(int amount) Sets the quantity of the item stack.applyPersistentHolder
(PersistentDataHolder newHolder, boolean replaceOld) Replaces the persistent data holder for the item stack.attributeModifiers
(List<AttributeModifier> modifiers, boolean showInTooltip) Updates the attribute modifiers of the item stack.bannerPatterns
(List<PatternData> patterns) Updates the banner patterns of the item stack.Updates the base color of the item stack.AbstractItemStack
<org.bukkit.inventory.ItemStack> blocksAttacks
(ItemDamage damage) Blocks attacks with the specified damage type using this item.AbstractItemStack
<org.bukkit.inventory.ItemStack> breakSound
(String sound) Set the break sound for this item stack.bucketEntityData
(boolean noAI, boolean silent, boolean noGravity, boolean glowing, boolean invulnerable, float health, int age, int variant, long huntingCooldown, int bucketVariantTag, String type) Updates the bucket entity data of the item stack.bundle
(Map<Integer, AbstractItemStack<org.bukkit.inventory.ItemStack>> items) Bundles a collection ofAbstractItemStack
instances into a single collection.org.bukkit.inventory.ItemStack
canBreak
(List<BlockPredicate> predicates) Updates the blocks that the item stack can break.canPlaceOn
(List<BlockPredicate> predicates) Updates the blocks that the item stack can be placed on.clone()
Map
<String, SerialComponent<AbstractItemStack<org.bukkit.inventory.ItemStack>, org.bukkit.inventory.ItemStack>> Retrieves the components applied to the item stack.consumable
(float consumeSeconds, String animation, String sound, boolean hasConsumeParticles, List<ComponentEffect> effects) Updates the consumable properties of the item stack.container
(Map<Integer, AbstractItemStack<org.bukkit.inventory.ItemStack>> items) Constructs a container with the given map of items.customName
(net.kyori.adventure.text.Component customName) Updates the custom name of the item stack.damage
(int damage) Updates the damage of the item stack.damageResistant
(List<String> types) Updates the damage-resistant types of the item stack.deathProtection
(List<ComponentEffect> deathEffects) Updates the death protection effects of the item stack.debug
(boolean debug) Enables or disables debug mode for the item stack.dyedColor
(int rgb) Updates the dyed color of the item stack.Adds an enchantment to the item stack.Adds enchantments to the item stack by name.Adds multiple enchantments to the item stack.enchantable
(int value) Updates the enchantability of the item stack.enchantmentGlintOverride
(boolean glintOverride) Updates the enchantment glint override of the item stack.enchantments
(Map<String, Integer> levels) Updates the enchantments of the item stack.AbstractItemStack
<org.bukkit.inventory.ItemStack> entityVariant
(String entity, String variant) Generates an AbstractItemStack based on the given entity and variant.equip
(String cameraKey, String equipSound, String modelKey, EquipSlot slot, boolean damageOnHurt, boolean dispensable, boolean swappable, boolean equipOnInteract, List<String> entities) Equips an item with specified parameters.fireworkExplosion
(ExplosionData explosion) Updates the firework explosion properties of the item stack.fireworks
(byte flightDuration, List<ExplosionData> explosions) Updates the fireworks properties of the item stack.flags()
Retrieves the item flags.Sets the item flags.food
(boolean noHunger, float saturation, int nutrition) Updates the food properties of the item stack.Updates the item stack to enable glider functionality.Updates the item stack to hide additional tooltip.Updates the item stack to hide its tooltip.instrument
(String soundEvent, int useDuration, int range) Updates the instrument properties of the item stack.Updates the item stack as an intangible projectile.boolean
isDirty()
Checks whether the object is dirty or has unsaved changes.Updates the model properties of the item stack.itemName
(net.kyori.adventure.text.Component itemName) Updates the name of the item stack.This method returns a String representing the item provider.Updates the jukebox properties of the item stack.lodestoneTracker
(String target, int[] pos, String dimension, boolean tracked) Updates the lodestone tracker properties of the item stack.Updates the lore of the item stack.loreComponent
(List<net.kyori.adventure.text.Component> lore) Sets the lore (descriptive text) of the item stack.mapColor
(int mapColor) Updates the map color of the item stack.mapId
(int mapId) Updates the map ID of the item stack.void
Marks the item stack as dirty, indicating changes have been made.material()
Returns the material of the item stack.Sets the material of the item stack.maxDamage
(int maxDamage) Updates the maximum damage of the item stack.maxStackSize
(int maxStackSize) Updates the maximum stack size of the item stack.Updates the model data of the item stack.AbstractItemStack
<org.bukkit.inventory.ItemStack> modelDataOld
(int customModelData) Deprecated.noteBlockSound
(String soundId) Updates the note block sound of the item stack.Creates a new item stack with the specified material and amount.of
(org.bukkit.inventory.ItemStack locale) Creates a new item stack from a locale-specific object.of
(org.json.simple.JSONObject json) Creates a new item stack from a JSON representation.ominousBottleAmplifier
(int amplifier) Updates the ominous bottle amplifier of the item stack.Retrieves the persistent data holder for the item stack.potDecorations
(List<String> decorations) Updates the pot decorations of the item stack.potionContents
(String potionId, int customColor, String customName, List<EffectInstance> effects) Updates the potion contents of the item stack.potionDuration
(float potionDuration) Sets the duration of a potion effect for the item stack.profile
(SkullProfile profile) Profiles the given SkullProfile to the BukkitItemStack object.ItemProvider
<org.bukkit.inventory.ItemStack> provider()
This method is used to return an ItemProvider object.Retrieves the provider item ID associated with the current object.AbstractItemStack
<org.bukkit.inventory.ItemStack> providesPattern
(String patternTag) Retrieve an AbstractItemStack object that provides a specific pattern identified by the patternTag.AbstractItemStack
<org.bukkit.inventory.ItemStack> providesTrim
(String material) Applies the specified trim materialUpdates the rarity of the item stack.Updates the recipes of the item stack.repairable
(List<String> repairItems) Updates the repairable items of the item stack.repairCost
(int repairCost) Updates the repair cost of the item stack.void
Resets the dirty flag, indicating that the object's state has been synchronized with the database.setItemProvider
(String itemProvider) Sets the item provider to be used for retrieving items.setProviderItemID
(String providerItemID) Sets the provider's item ID for the current item.int
slot()
Represents the inventory slot of the item stack.slot
(int slot) Sets the inventory slot of the item stack.storedEnchantments
(Map<String, Integer> enchantments) Updates the stored enchantments of the item stack.AbstractItemStack
<org.bukkit.inventory.ItemStack> suspiciousStewEffects
(List<EffectInstance> effects) Applies the given effects to the suspicious stew item.AbstractItemStack
<org.bukkit.inventory.ItemStack> suspiciousStewEffects
(EffectInstance... effects) Applies the given effects to a suspicious stew item.org.json.simple.JSONObject
toJSON()
Converts the object to a JSONObject representation.Constructs a new tool item with the specified characteristics.AbstractItemStack
<org.bukkit.inventory.ItemStack> tooltipDisplay
(boolean hideTooltip, String... hiddenComponents) Displays tooltip for the item stack with an option to hide certain components.tooltipStyle
(String style) Updates the tooltip style of the item stack.Updates the trim properties of the item stack.unbreakable
(boolean showInTooltip) Updates the unbreakable property of the item stack.void
updateCache
(org.bukkit.inventory.ItemStack localeStack) useCooldown
(String cooldownGroup, float seconds) Updates the use cooldown properties of the item stack.weapon
(int damagePerAttack, boolean canDisableBlocking) Represents a weapon item that can be used for combat.writableBookContent
(List<String> pages) Updates the writable book content of the item stack.writtenBookContent
(String title, String author, int generation, boolean resolved, List<String> pages) Updates the written book content of the item stack.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.tnemc.item.AbstractItemStack
add, applyComponent, applyPersistent, attributeModifiers, bannerPatterns, baseColor, blocksAttacks, breakSound, bucketEntityData, bundle, canBreak, canPlaceOn, component, consumable, container, customName, damage, damageResistant, deathProtection, dyedColor, enchantable, enchantmentGlintOverride, enchantments, entityVariant, equip, fireworkExplosion, fireworks, food, glider, hasComponent, hideAdditionalTooltip, hideTooltip, instrument, intangibleProjectile, itemModel, itemName, jukebox, lodestoneTracker, lore, mapColor, mapId, maxDamage, maxStackSize, modelData, modelDataOld, noteBlockSound, ominousBottleAmplifier, potDecorations, potionContents, potionDuration, profile, profile, profile, providesPattern, providesTrim, rarity, recipes, repairable, repairCost, storedEnchantments, subtract, suspiciousStewEffects, tool, tooltipDisplay, tooltipStyle, trim, unbreakable, useCooldown, weapon, writableBookContent, writtenBookContent
-
Constructor Details
-
BukkitItemStack
public BukkitItemStack()
-
-
Method Details
-
of
Creates a new item stack with the specified material and amount.- Specified by:
of
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
material
- The material of the item.amount
- The number of items in the stack.- Returns:
- A new item stack instance.
-
of
Creates a new item stack from a locale-specific object.- Specified by:
of
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
locale
- The locale-specific representation.- Returns:
- A new item stack instance.
-
of
public BukkitItemStack of(org.json.simple.JSONObject json) throws org.json.simple.parser.ParseException Creates a new item stack from a JSON representation.- Specified by:
of
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
json
- The JSON object containing item stack data.- Returns:
- A new item stack instance.
- Throws:
org.json.simple.parser.ParseException
- If the JSON structure is invalid.
-
flags
Sets the item flags.- Specified by:
flags
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
flags
- A list of flags to apply to the item.- Returns:
- The updated item stack instance.
-
loreComponent
Sets the lore (descriptive text) of the item stack.- Specified by:
loreComponent
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
lore
- A list of components representing the lore.- Returns:
- The updated item stack instance.
-
enchant
Adds an enchantment to the item stack.- Specified by:
enchant
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
enchantment
- The enchantment name.level
- The level of the enchantment.- Returns:
- The updated item stack instance.
-
enchant
Adds multiple enchantments to the item stack.- Specified by:
enchant
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
enchantments
- A map of enchantment names and levels.- Returns:
- The updated item stack instance.
-
enchant
Adds enchantments to the item stack by name.- Specified by:
enchant
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
enchantments
- A list of enchantment names.- Returns:
- The updated item stack instance.
-
material
Returns the material of the item stack.- Specified by:
material
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- The material of the item stack.
-
material
Sets the material of the item stack.- Specified by:
material
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
material
- The material name.- Returns:
- The updated item stack instance.
-
amount
The quantity of the item stack.- Specified by:
amount
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- the quantity of the item stack.
-
amount
Sets the quantity of the item stack.- Specified by:
amount
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
amount
- The number of items in the stack.- Returns:
- The updated item stack instance.
-
slot
Represents the inventory slot of the item stack.- Specified by:
slot
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- the inventory slot of the item stack.
-
slot
Sets the inventory slot of the item stack.- Specified by:
slot
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
slot
- The slot index.- Returns:
- The updated item stack instance.
-
debug
Enables or disables debug mode for the item stack.- Specified by:
debug
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
debug
- True to enable, false to disable.- Returns:
- The updated item stack instance.
-
cacheLocale
-
updateCache
-
applyPersistentHolder
Replaces the persistent data holder for the item stack.- Specified by:
applyPersistentHolder
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
newHolder
- The new persistent data holder.replaceOld
- True to replace existing data, false to merge.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
flags
Retrieves the item flags.- Specified by:
flags
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- A list of flags applied to the item.
-
components
public Map<String,SerialComponent<AbstractItemStack<org.bukkit.inventory.ItemStack>, components()org.bukkit.inventory.ItemStack>> Retrieves the components applied to the item stack.- Specified by:
components
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- A map of component types and their serialized representations.
- Since:
- 0.2.0.0
-
persistentHolder
Retrieves the persistent data holder for the item stack.- Specified by:
persistentHolder
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- The persistent data holder.
- Since:
- 0.2.0.0
-
resetDirty
Resets the dirty flag, indicating that the object's state has been synchronized with the database.- Specified by:
resetDirty
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
-
markDirty
Marks the item stack as dirty, indicating changes have been made.- Specified by:
markDirty
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
-
isDirty
Checks whether the object is dirty or has unsaved changes.- Specified by:
isDirty
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- true if the object is dirty, false otherwise
-
itemProvider
This method returns a String representing the item provider.- Specified by:
itemProvider
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- the item provider as a String
- See Also:
-
setItemProvider
Sets the item provider to be used for retrieving items.- Specified by:
setItemProvider
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
itemProvider
- the string representing the item provider to be set
-
providerItemID
Retrieves the provider item ID associated with the current object.- Specified by:
providerItemID
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- The provider item ID of the object.
-
setProviderItemID
Sets the provider's item ID for the current item.- Specified by:
setProviderItemID
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
providerItemID
- the unique ID assigned by the provider for the item
-
provider
This method is used to return an ItemProvider object.- Specified by:
provider
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- ItemProvider object representing the item provider.
-
toJSON
Converts the object to a JSONObject representation.- Specified by:
toJSON
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- A JSONObject representing the object data.
-
clone
-
attributeModifiers
Updates the attribute modifiers of the item stack.- Specified by:
attributeModifiers
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
modifiers
- a list of attribute modifiersshowInTooltip
- whether to display the modifiers in the tooltip- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
bannerPatterns
Updates the banner patterns of the item stack.- Specified by:
bannerPatterns
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
patterns
- a list of pattern data- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
baseColor
Updates the base color of the item stack.- Specified by:
baseColor
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
color
- the new base color- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
blocksAttacks
Blocks attacks with the specified damage type using this item.- Specified by:
blocksAttacks
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
damage
- the type of damage to block attacks from- Returns:
- an AbstractItemStack object representing the item after blocking attacks
- Since:
- 0.2.0.0
- See Also:
-
breakSound
Set the break sound for this item stack.- Specified by:
breakSound
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
sound
- the sound to be played when the item is broken- Returns:
- the updated item stack object
- Since:
- 0.2.0.0
- See Also:
-
bucketEntityData
public BukkitItemStack bucketEntityData(boolean noAI, boolean silent, boolean noGravity, boolean glowing, boolean invulnerable, float health, int age, int variant, long huntingCooldown, int bucketVariantTag, String type) Updates the bucket entity data of the item stack.- Specified by:
bucketEntityData
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
noAI
- whether the entity has AI disabledsilent
- whether the entity is silentnoGravity
- whether the entity is affected by gravityglowing
- whether the entity is glowinginvulnerable
- whether the entity is invulnerablehealth
- the health of the entityage
- the age of the entityvariant
- the variant of the entityhuntingCooldown
- the hunting cooldown of the entitybucketVariantTag
- the variant tag of the buckettype
- the type of the entity- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
bundle
Bundles a collection ofAbstractItemStack
instances into a single collection.- Specified by:
bundle
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
items
- AMap
containing integer keys andAbstractItemStack
values to be bundled.- Returns:
- An
AbstractItemStack
instance that represents the bundled items. - Since:
- 0.2.0.0
- See Also:
-
canBreak
Updates the blocks that the item stack can break.- Specified by:
canBreak
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
predicates
- a list of block predicates- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
canPlaceOn
Updates the blocks that the item stack can be placed on.- Specified by:
canPlaceOn
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
predicates
- a list of block predicates- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
consumable
public BukkitItemStack consumable(float consumeSeconds, String animation, String sound, boolean hasConsumeParticles, List<ComponentEffect> effects) Updates the consumable properties of the item stack.- Specified by:
consumable
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
consumeSeconds
- the time it takes to consume the itemanimation
- the animation to display when consumingsound
- the sound to play when consuminghasConsumeParticles
- whether to show consume particleseffects
- a list of effects applied on consumption- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
container
public BukkitItemStack container(Map<Integer, AbstractItemStack<org.bukkit.inventory.ItemStack>> items) Constructs a container with the given map of items.- Specified by:
container
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
items
- a map of items where the key is the position of the item in the container and the value is the item- Returns:
- an AbstractItemStack container with the specified items
- Since:
- 0.2.0.0
- See Also:
-
customName
Updates the custom name of the item stack.- Specified by:
customName
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
customName
- the custom name to set- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
damage
Updates the damage of the item stack.- Specified by:
damage
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
damage
- the damage value to set- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
damageResistant
Updates the damage-resistant types of the item stack.- Specified by:
damageResistant
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
types
- a list of damage-resistant types- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
deathProtection
Updates the death protection effects of the item stack.- Specified by:
deathProtection
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
deathEffects
- a list of death protection effects- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
dyedColor
Updates the dyed color of the item stack.- Specified by:
dyedColor
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
rgb
- the RGB color value to set- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
enchantable
Updates the enchantability of the item stack.- Specified by:
enchantable
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
value
- the enchantability value to set- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
enchantmentGlintOverride
Updates the enchantment glint override of the item stack.- Specified by:
enchantmentGlintOverride
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
glintOverride
- whether the enchantment glint should be overridden- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
enchantments
Updates the enchantments of the item stack.- Specified by:
enchantments
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
levels
- a map of enchantments and their levels- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
entityVariant
public AbstractItemStack<org.bukkit.inventory.ItemStack> entityVariant(String entity, String variant) Generates an AbstractItemStack based on the given entity and variant.- Specified by:
entityVariant
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
entity
- the entity name to create the stack forvariant
- the variant of the entity- Returns:
- an AbstractItemStack representing the entity with the specified variant
- Since:
- 0.2.0.0
- See Also:
-
equip
public BukkitItemStack equip(String cameraKey, String equipSound, String modelKey, EquipSlot slot, boolean damageOnHurt, boolean dispensable, boolean swappable, boolean equipOnInteract, List<String> entities) Equips an item with specified parameters.- Specified by:
equip
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
cameraKey
- the key identifying the cameraequipSound
- the key identifying the equip soundmodelKey
- the key identifying the modelslot
- the slot in which the item should be equippeddamageOnHurt
- flag indicating if damage should be taken on hurtdispensable
- flag indicating if the item is dispensableswappable
- flag indicating if the item is swappableequipOnInteract
- flag indicating if the item should be equipped on interactentities
- a list of entities to be equipped- Returns:
- an BukkitItemStack object representing the equipped item
- Since:
- 0.2.0.0
- See Also:
-
fireworkExplosion
Updates the firework explosion properties of the item stack.- Specified by:
fireworkExplosion
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
explosion
- the explosion data to set- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
fireworks
Updates the fireworks properties of the item stack.- Specified by:
fireworks
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
flightDuration
- the flight duration of the fireworksexplosions
- a list of explosion data- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
food
Updates the food properties of the item stack.- Specified by:
food
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
noHunger
- whether the item causes no hungersaturation
- the saturation valuenutrition
- the nutrition value- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
gliderTag
Updates the item stack to enable glider functionality.- Specified by:
gliderTag
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
hideAdditionalTooltipTag
Updates the item stack to hide additional tooltip.- Specified by:
hideAdditionalTooltipTag
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
hideTooltipTag
Updates the item stack to hide its tooltip.- Specified by:
hideTooltipTag
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
instrument
Updates the instrument properties of the item stack.- Specified by:
instrument
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
soundEvent
- the sound event identifieruseDuration
- the duration of the sound in ticksrange
- the range of the sound- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
intangibleProjectileTag
Updates the item stack as an intangible projectile.- Specified by:
intangibleProjectileTag
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
itemModel
Updates the model properties of the item stack.- Specified by:
itemModel
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
model
- the model identifier- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
itemName
Updates the name of the item stack.- Specified by:
itemName
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
itemName
- the name of the item- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
jukebox
Updates the jukebox properties of the item stack.- Specified by:
jukebox
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
song
- the song identifiershowInTooltip
- whether to display the song in the tooltip- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
lodestoneTracker
public BukkitItemStack lodestoneTracker(String target, int[] pos, String dimension, boolean tracked) Updates the lodestone tracker properties of the item stack.- Specified by:
lodestoneTracker
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
target
- the target identifierpos
- the position arraydimension
- the dimension identifiertracked
- whether the lodestone is tracked- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
lore
Updates the lore of the item stack.- Specified by:
lore
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
lore
- a list of lore strings- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
mapColor
Updates the map color of the item stack.- Specified by:
mapColor
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
mapColor
- the map color value- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
mapId
Updates the map ID of the item stack.- Specified by:
mapId
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
mapId
- the map ID value- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
maxDamage
Updates the maximum damage of the item stack.- Specified by:
maxDamage
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
maxDamage
- the maximum damage value- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
maxStackSize
Updates the maximum stack size of the item stack.- Specified by:
maxStackSize
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
maxStackSize
- the maximum stack size value- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
modelData
public BukkitItemStack modelData(List<String> colours, List<Float> floats, List<Boolean> flags, List<String> strings) Updates the model data of the item stack.- Specified by:
modelData
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
colours
- a list of color stringsfloats
- a list of float valuesflags
- a list of boolean flagsstrings
- a list of string identifiers- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
modelDataOld
Deprecated.Since MC 1.21.3 UseItemModelComponent
andModelDataComponent
.Retrieves the model data for a custom item stack.- Specified by:
modelDataOld
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
customModelData
- the custom model data to retrieve- Returns:
- an AbstractItemStack with the specified custom model data
- Since:
- 0.2.0.0
- See Also:
-
noteBlockSound
Updates the note block sound of the item stack.- Specified by:
noteBlockSound
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
soundId
- the identifier of the sound- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
ominousBottleAmplifier
Updates the ominous bottle amplifier of the item stack.- Specified by:
ominousBottleAmplifier
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
amplifier
- the amplifier value- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
potDecorations
Updates the pot decorations of the item stack.- Specified by:
potDecorations
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
decorations
- a list of decorations- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
potionContents
public BukkitItemStack potionContents(String potionId, int customColor, String customName, List<EffectInstance> effects) Updates the potion contents of the item stack.- Specified by:
potionContents
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
potionId
- the ID of the potioncustomColor
- the custom color of the potioncustomName
- the custom name of the potioneffects
- a list of effect instances- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
potionDuration
Sets the duration of a potion effect for the item stack. Since MC Snapshot 25w02a.- Specified by:
potionDuration
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
potionDuration
- the duration of the potion effect in seconds- Returns:
- the modified BukkitItemStack object with the updated potion duration
- Since:
- 0.2.0.0
- See Also:
-
profile
Profiles the given SkullProfile to the BukkitItemStack object.- Specified by:
profile
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
profile
- the SkullProfile to be assigned- Returns:
- an BukkitItemStack object with the provided profile
-
providesPattern
Retrieve an AbstractItemStack object that provides a specific pattern identified by the patternTag.- Specified by:
providesPattern
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
patternTag
- The unique identifier of the pattern to be provided.- Returns:
- An AbstractItemStack object that provides the specified pattern.
- Since:
- 0.2.0.0
- See Also:
-
providesTrim
Applies the specified trim material- Specified by:
providesTrim
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
material
- the trim material- Returns:
- an AbstractItemStack object representing the trimmed material
- Since:
- 0.2.0.0
- See Also:
-
rarity
Updates the rarity of the item stack.- Specified by:
rarity
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
rarity
- the rarity value- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
recipes
Updates the recipes of the item stack.- Specified by:
recipes
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
recipes
- a list of recipe identifiers- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
repairable
Updates the repairable items of the item stack.- Specified by:
repairable
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
repairItems
- a list of repair item identifiers- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
repairCost
Updates the repair cost of the item stack.- Specified by:
repairCost
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
repairCost
- the repair cost value- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
storedEnchantments
Updates the stored enchantments of the item stack.- Specified by:
storedEnchantments
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
enchantments
- a map of enchantment names to their levels- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
suspiciousStewEffects
public AbstractItemStack<org.bukkit.inventory.ItemStack> suspiciousStewEffects(List<EffectInstance> effects) Applies the given effects to the suspicious stew item.- Specified by:
suspiciousStewEffects
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
effects
- a list of EffectInstance objects representing the effects to be applied to the suspicious stew- Returns:
- an AbstractItemStack representing the suspicious stew with the applied effects
- Since:
- 0.2.0.0
- See Also:
-
suspiciousStewEffects
public AbstractItemStack<org.bukkit.inventory.ItemStack> suspiciousStewEffects(EffectInstance... effects) Applies the given effects to a suspicious stew item.- Specified by:
suspiciousStewEffects
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
effects
- an array of EffectInstance objects representing the effects to apply to the suspicious stew- Returns:
- an AbstractItemStack representing the suspicious stew item with the applied effects
- Since:
- 0.2.0.0
- See Also:
-
tool
public BukkitItemStack tool(float defaultSpeed, int blockDamage, boolean canDestroyBlocksCreative, List<ToolRule> rules) Constructs a new tool item with the specified characteristics.- Specified by:
tool
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
defaultSpeed
- the default speed of the toolblockDamage
- the damage inflicted by the tool to blockscanDestroyBlocksCreative
- if the tool can destroy blocks in creative moderules
- a list of rules that define the behavior of the tool- Returns:
- an BukkitItemStack instance representing the created tool
- Since:
- 0.2.0.0
- See Also:
-
tooltipDisplay
public AbstractItemStack<org.bukkit.inventory.ItemStack> tooltipDisplay(boolean hideTooltip, String... hiddenComponents) Displays tooltip for the item stack with an option to hide certain components.- Specified by:
tooltipDisplay
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
hideTooltip
- Flag to hide the tooltiphiddenComponents
- Array of components to hide in the tooltip- Returns:
- An AbstractItemStack object with the tooltip displayed
- Since:
- 0.2.0.0
- See Also:
-
tooltipStyle
Updates the tooltip style of the item stack.- Specified by:
tooltipStyle
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
style
- the style to apply to the tooltip- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
trim
Updates the trim properties of the item stack.- Specified by:
trim
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
pattern
- the trim patternmaterial
- the trim materialshowInTooltip
- whether to display the trim in the tooltip- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
unbreakable
Updates the unbreakable property of the item stack.- Specified by:
unbreakable
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
showInTooltip
- whether to display the unbreakable property in the tooltip- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
useCooldown
Updates the use cooldown properties of the item stack.- Specified by:
useCooldown
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
cooldownGroup
- the cooldown group identifierseconds
- the cooldown duration in seconds- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
weapon
Represents a weapon item that can be used for combat. Since MC Snapshot 25w02a.- Specified by:
weapon
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
damagePerAttack
- The amount of damage this weapon inflicts per attackcanDisableBlocking
- Whether this weapon can disable blocking when used- Since:
- 0.2.0.0
- See Also:
-
writableBookContent
Updates the writable book content of the item stack.- Specified by:
writableBookContent
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
pages
- the pages to include in the writable book- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
writtenBookContent
public BukkitItemStack writtenBookContent(String title, String author, int generation, boolean resolved, List<String> pages) Updates the written book content of the item stack.- Specified by:
writtenBookContent
in interfaceAbstractItemStack<org.bukkit.inventory.ItemStack>
- Parameters:
title
- the title of the bookauthor
- the author of the bookgeneration
- the generation of the bookresolved
- whether the book is resolvedpages
- the pages to include in the book- Returns:
- the updated BukkitItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
ItemModelComponent
andModelDataComponent
.