Package org.bukkit.inventory.meta
Interface PotionMeta
- All Superinterfaces:
Cloneable
,ConfigurationSerializable
,ItemMeta
,PersistentDataHolder
,PersistentDataViewHolder
Represents a potion or item that can have custom effects.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addCustomEffect
(@NotNull PotionEffect effect, boolean overwrite) Adds a custom potion effect to this potion.boolean
Removes all custom potion effects from this potion.clone()
Deprecated.Returns the potion type about the base potiongetColor()
Gets the potion color that is set.Gets an immutable list containing all custom potion effects applied to this potion.boolean
Checks for the presence of a base potion typeboolean
hasColor()
Checks for existence of a potion color.boolean
Checks for a specific custom potion effect type on this potion.boolean
Checks for the presence of custom potion effects.boolean
Removes a custom potion effect from this potion.void
Deprecated.Upgraded / extended potions are now their ownPotionType
usesetBasePotionType(org.bukkit.potion.PotionType)
instead.void
Sets the underlying potion typevoid
Sets the potion color.boolean
Deprecated.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
Methods inherited from interface org.bukkit.inventory.meta.ItemMeta
addAttributeModifier, addEnchant, addItemFlags, displayName, displayName, getAsComponentString, getAsString, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCanDestroy, getCanPlaceOn, getCustomModelData, getCustomTagContainer, getDestroyableKeys, getDisplayName, getDisplayNameComponent, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getFood, getItemFlags, getItemName, getJukeboxPlayable, getLocalizedName, getLore, getLoreComponents, getMaxStackSize, getPlaceableKeys, getRarity, getTool, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasDestroyableKeys, hasDisplayName, hasEnchant, hasEnchantmentGlintOverride, hasEnchants, hasFood, hasItemFlag, hasItemName, hasJukeboxPlayable, hasLocalizedName, hasLore, hasMaxStackSize, hasPlaceableKeys, hasRarity, hasTool, isFireResistant, isHideTooltip, isUnbreakable, itemName, itemName, lore, lore, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchantments, removeItemFlags, setAttributeModifiers, setCanDestroy, setCanPlaceOn, setCustomModelData, setDestroyableKeys, setDisplayName, setDisplayNameComponent, setEnchantmentGlintOverride, setFireResistant, setFood, setHideTooltip, setItemName, setJukeboxPlayable, setLocalizedName, setLore, setLoreComponents, setMaxStackSize, setPlaceableKeys, setRarity, setTool, setUnbreakable, setVersion
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
-
Method Details
-
setBasePotionData
Deprecated.Upgraded / extended potions are now their ownPotionType
usesetBasePotionType(org.bukkit.potion.PotionType)
instead.Sets the underlying potion data- Parameters:
data
- PotionData to set the base potion state to
-
getBasePotionData
Deprecated.Upgraded / extended potions are now their ownPotionType
usegetBasePotionType()
instead.Returns the potion data about the base potion- Returns:
- a PotionData object
-
setBasePotionType
Sets the underlying potion type- Parameters:
type
- PotionType to set the base potion state to
-
getBasePotionType
Returns the potion type about the base potion- Returns:
- a PotionType object
-
hasBasePotionType
boolean hasBasePotionType()Checks for the presence of a base potion type- Returns:
- true if a base potion type is present
-
hasCustomEffects
boolean hasCustomEffects()Checks for the presence of custom potion effects.- Returns:
- true if custom potion effects are applied
-
getCustomEffects
Gets an immutable list containing all custom potion effects applied to this potion.Plugins should check that hasCustomEffects() returns true before calling this method.
- Returns:
- the immutable list of custom potion effects
-
addCustomEffect
Adds a custom potion effect to this potion.- Parameters:
effect
- the potion effect to addoverwrite
- true if any existing effect of the same type should be overwritten- Returns:
- true if the potion meta changed as a result of this call
-
removeCustomEffect
Removes a custom potion effect from this potion.- Parameters:
type
- the potion effect type to remove- Returns:
- true if the potion meta changed as a result of this call
-
hasCustomEffect
Checks for a specific custom potion effect type on this potion.- Parameters:
type
- the potion effect type to check for- Returns:
- true if the potion has this effect
-
setMainEffect
Deprecated.Moves a potion effect to the top of the potion effect list.This causes the client to display the potion effect in the potion's name.
- Parameters:
type
- the potion effect type to move- Returns:
- true if the potion meta changed as a result of this call
-
clearCustomEffects
boolean clearCustomEffects()Removes all custom potion effects from this potion.- Returns:
- true if the potion meta changed as a result of this call
-
hasColor
boolean hasColor()Checks for existence of a potion color.- Returns:
- true if this has a custom potion color
-
getColor
Gets the potion color that is set. A custom potion color will alter the display of the potion in an inventory slot.Plugins should check that hasColor() returns
true
before calling this method.- Returns:
- the potion color that is set
-
setColor
Sets the potion color. A custom potion color will alter the display of the potion in an inventory slot.- Parameters:
color
- the color to set
-
clone
PotionMeta clone()
-
PotionType
usegetBasePotionType()
instead.