Package org.bukkit.inventory.meta
Interface PotionMeta
-
- All Superinterfaces:
Cloneable,ConfigurationSerializable,ItemMeta
public interface PotionMeta extends ItemMeta
Represents a potion or item that can have custom effects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.bukkit.inventory.meta.ItemMeta
ItemMeta.Spigot
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleanaddCustomEffect(PotionEffect effect, boolean overwrite)Adds a custom potion effect to this potion.booleanclearCustomEffects()Removes all custom potion effects from this potion.PotionMetaclone()PotionDatagetBasePotionData()Returns the potion data about the base potionColorgetColor()Gets the potion color that is set.List<PotionEffect>getCustomEffects()Gets an immutable list containing all custom potion effects applied to this potion.booleanhasColor()Checks for existence of a potion color.booleanhasCustomEffect(PotionEffectType type)Checks for a specific custom potion effect type on this potion.booleanhasCustomEffects()Checks for the presence of custom potion effects.booleanremoveCustomEffect(PotionEffectType type)Removes a custom potion effect from this potion.voidsetBasePotionData(PotionData data)Sets the underlying potion datavoidsetColor(Color color)Sets the potion color.booleansetMainEffect(PotionEffectType type)Deprecated.usePotionType(org.bukkit.potion.PotionEffectType, boolean, boolean)-
Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
Methods inherited from interface org.bukkit.inventory.meta.ItemMeta
addEnchant, addItemFlags, getDisplayName, getEnchantLevel, getEnchants, getItemFlags, getLocalizedName, getLore, hasConflictingEnchant, hasDisplayName, hasEnchant, hasEnchants, hasItemFlag, hasLocalizedName, hasLore, isUnbreakable, removeEnchant, removeItemFlags, setDisplayName, setLocalizedName, setLore, setUnbreakable, spigot
-
-
-
-
Method Detail
-
setBasePotionData
void setBasePotionData(PotionData data)
Sets the underlying potion data- Parameters:
data- PotionData to set the base potion state to
-
getBasePotionData
PotionData getBasePotionData()
Returns the potion data about the base potion- Returns:
- a PotionData object
-
hasCustomEffects
boolean hasCustomEffects()
Checks for the presence of custom potion effects.- Returns:
- true if custom potion effects are applied
-
getCustomEffects
List<PotionEffect> 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
boolean addCustomEffect(PotionEffect effect, boolean overwrite)
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
boolean removeCustomEffect(PotionEffectType type)
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
boolean hasCustomEffect(PotionEffectType type)
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 boolean setMainEffect(PotionEffectType type)
Deprecated.usePotionType(org.bukkit.potion.PotionEffectType, boolean, boolean)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
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
truebefore calling this method.- Returns:
- the potion color that is set
-
setColor
void setColor(Color color)
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()
-
-