Package org.bukkit.inventory.meta
Interface FireworkMeta
- All Superinterfaces:
Cloneable
,ConfigurationSerializable
,ItemMeta
,PersistentDataHolder
,PersistentDataViewHolder
Represents a
Material.FIREWORK_ROCKET
and its effects.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEffect
(@NotNull FireworkEffect effect) Add another effect to this firework.void
addEffects
(@NotNull Iterable<FireworkEffect> effects) Add several firework effects to this firework.void
addEffects
(@NotNull FireworkEffect... effects) Add several effects to this firework.void
Remove all effects from this firework.clone()
Get the effects in this firework.int
Get the number of effects in this firework.int
getPower()
Gets the approximate height the firework will fly.boolean
Get whether this firework has any effects.boolean
hasPower()
Get whether this firework has power set by component.void
removeEffect
(int index) Remove an effect from this firework.void
setPower
(int power) Sets the approximate power of the firework.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
Methods inherited from interface org.bukkit.inventory.meta.ItemMeta
addAttributeModifier, addEnchant, addItemFlags, customName, customName, displayName, displayName, getAsComponentString, getAsString, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCanDestroy, getCanPlaceOn, getCustomModelData, getCustomModelDataComponent, getCustomTagContainer, getDamageResistant, getDestroyableKeys, getDisplayName, getDisplayNameComponent, getEnchantable, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getEquippable, getFood, getItemFlags, getItemModel, getItemName, getJukeboxPlayable, getLocalizedName, getLore, getLoreComponents, getMaxStackSize, getPlaceableKeys, getRarity, getTool, getTooltipStyle, getUseCooldown, getUseRemainder, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasCustomName, hasDamageResistant, hasDestroyableKeys, hasDisplayName, hasEnchant, hasEnchantable, hasEnchantmentGlintOverride, hasEnchants, hasEquippable, hasFood, hasItemFlag, hasItemModel, hasItemName, hasJukeboxPlayable, hasLocalizedName, hasLore, hasMaxStackSize, hasPlaceableKeys, hasRarity, hasTool, hasTooltipStyle, hasUseCooldown, hasUseRemainder, isFireResistant, isGlider, isHideTooltip, isUnbreakable, itemName, itemName, lore, lore, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchantments, removeItemFlags, setAttributeModifiers, setCanDestroy, setCanPlaceOn, setCustomModelData, setCustomModelDataComponent, setDamageResistant, setDestroyableKeys, setDisplayName, setDisplayNameComponent, setEnchantable, setEnchantmentGlintOverride, setEquippable, setFireResistant, setFood, setGlider, setHideTooltip, setItemModel, setItemName, setJukeboxPlayable, setLocalizedName, setLore, setLoreComponents, setMaxStackSize, setPlaceableKeys, setRarity, setTool, setTooltipStyle, setUnbreakable, setUseCooldown, setUseRemainder, setVersion
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
-
Method Details
-
addEffect
Add another effect to this firework.- Parameters:
effect
- The firework effect to add- Throws:
IllegalArgumentException
- If effect is null
-
addEffects
Add several effects to this firework.- Parameters:
effects
- The firework effects to add- Throws:
IllegalArgumentException
- If effects is nullIllegalArgumentException
- If any effect is null (may be thrown after changes have occurred)
-
addEffects
Add several firework effects to this firework.- Parameters:
effects
- An iterable object whose iterator yields the desired firework effects- Throws:
IllegalArgumentException
- If effects is nullIllegalArgumentException
- If any effect is null (may be thrown after changes have occurred)
-
getEffects
Get the effects in this firework.- Returns:
- An immutable list of the firework effects
-
getEffectsSize
int getEffectsSize()Get the number of effects in this firework.- Returns:
- The number of effects
-
removeEffect
Remove an effect from this firework.- Parameters:
index
- The index of the effect to remove- Throws:
IndexOutOfBoundsException
- If index < 0 or index >getEffectsSize()
-
clearEffects
void clearEffects()Remove all effects from this firework. -
hasEffects
boolean hasEffects()Get whether this firework has any effects.- Returns:
- true if it has effects, false if there are no effects
-
hasPower
boolean hasPower()Get whether this firework has power set by component.- Returns:
- true if it has power set, false if there are no power set
-
getPower
int getPower()Gets the approximate height the firework will fly.
Plugins should check that hasPower() returnstrue
before calling this method.- Returns:
- approximate flight height of the firework.
- See Also:
-
setPower
Sets the approximate power of the firework. Each level of power is half a second of flight time.- Parameters:
power
- the power of the firework, from 0-255- Throws:
IllegalArgumentException
- if power<0 or power>255
-
clone
-