Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
org.bukkit.potion.Potion Class Reference

Represents a minecraft potion. More...

Classes

enum  Tier
 

Public Member Functions

 Potion (PotionType type)
 Construct a new potion of the given type.
 
 Potion (PotionType type, Tier tier)
 
 Potion (PotionType type, Tier tier, boolean splash)
 
 Potion (PotionType type, Tier tier, boolean splash, boolean extended)
 
 Potion (PotionType type, int level)
 Create a new potion of the given type and level.
 
 Potion (PotionType type, int level, boolean splash)
 Create a new potion of the given type and level.
 
 Potion (PotionType type, int level, boolean splash, boolean extended)
 Create a new potion of the given type and level.
 
 Potion (int name)
 Create a potion with a specific name.
 
Potion splash ()
 Chain this to the constructor to make the potion a splash potion.
 
Potion extend ()
 Chain this to the constructor to extend the potion's duration.
 
void apply (ItemStack to)
 Applies the effects of this potion to the given ItemStack.
 
void apply (LivingEntity to)
 Applies the effects that would be applied by this potion to the given LivingEntity.
 
boolean equals (Object obj)
 
Collection< PotionEffectgetEffects ()
 Returns a collection of PotionEffects that this Potion would confer upon a LivingEntity.
 
int getLevel ()
 Returns the level of this potion.
 
Tier getTier ()
 Returns the Tier of this potion.
 
PotionType getType ()
 Returns the PotionType of this potion.
 
boolean hasExtendedDuration ()
 Returns whether this potion has an extended duration.
 
int hashCode ()
 
boolean isSplash ()
 Returns whether this potion is a splash potion.
 
void setHasExtendedDuration (boolean isExtended)
 Set whether this potion has extended duration.
 
void setSplash (boolean isSplash)
 Sets whether this potion is a splash potion.
 
void setTier (Tier tier)
 Sets the Tier of this potion.
 
void setType (PotionType type)
 Sets the PotionType of this potion.
 
void setLevel (int level)
 Sets the level of this potion.
 
short toDamageValue ()
 Converts this potion to a valid potion damage short, usable for potion item stacks.
 
ItemStack toItemStack (int amount)
 Converts this potion to an ItemStack with the specified amount and a correct damage value.
 
int getNameId ()
 

Static Public Member Functions

static Potion fromDamage (int damage)
 
static Potion fromItemStack (ItemStack item)
 
static PotionBrewer getBrewer ()
 Returns an instance of PotionBrewer.
 
static void setPotionBrewer (PotionBrewer other)
 Sets the current instance of PotionBrewer.
 

Detailed Description

Represents a minecraft potion.

Definition at line 15 of file Potion.java.

Constructor & Destructor Documentation

org.bukkit.potion.Potion.Potion ( PotionType  type)

Construct a new potion of the given type.

Unless the type is PotionType#WATER, it will be level one, without extended duration. Don't use this constructor to create a no-effect potion other than water bottle.

Parameters
typeThe potion type
See Also
Potion(int)

Definition at line 29 of file Potion.java.

References org.bukkit.potion.PotionType.getDamageValue(), and org.bukkit.potion.PotionType.WATER.

Referenced by org.bukkit.potion.Potion.equals(), and org.bukkit.potion.Potion.fromDamage().

org.bukkit.potion.Potion.Potion ( PotionType  type,
Tier  tier 
)
Deprecated:
In favour of Potion(PotionType, int)

Definition at line 42 of file Potion.java.

References org.bukkit.potion.Potion.Tier.TWO.

org.bukkit.potion.Potion.Potion ( PotionType  type,
Tier  tier,
boolean  splash 
)
org.bukkit.potion.Potion.Potion ( PotionType  type,
Tier  tier,
boolean  splash,
boolean  extended 
)
org.bukkit.potion.Potion.Potion ( PotionType  type,
int  level 
)

Create a new potion of the given type and level.

Parameters
typeThe type of potion.
levelThe potion's level.

Definition at line 67 of file Potion.java.

References org.bukkit.potion.PotionType.WATER.

org.bukkit.potion.Potion.Potion ( PotionType  type,
int  level,
boolean  splash 
)

Create a new potion of the given type and level.

Parameters
typeThe type of potion.
levelThe potion's level.
splashWhether it is a splash potion.
Deprecated:
In favour of using Potion(PotionType) with splash().

Definition at line 83 of file Potion.java.

References org.bukkit.potion.Potion.splash().

org.bukkit.potion.Potion.Potion ( PotionType  type,
int  level,
boolean  splash,
boolean  extended 
)

Create a new potion of the given type and level.

Parameters
typeThe type of potion.
levelThe potion's level.
splashWhether it is a splash potion.
extendedWhether it has an extended duration.
Deprecated:
In favour of using Potion(PotionType) with extend() and possibly splash().

Definition at line 98 of file Potion.java.

References org.bukkit.potion.Potion.splash().

org.bukkit.potion.Potion.Potion ( int  name)

Create a potion with a specific name.

Parameters
nameThe name index (0-63)

Definition at line 107 of file Potion.java.

References org.bukkit.potion.PotionType.getByDamageValue().

Member Function Documentation

void org.bukkit.potion.Potion.apply ( ItemStack  to)

Applies the effects of this potion to the given ItemStack.

The itemstack must be a potion.

Parameters
toThe itemstack to apply to

Definition at line 140 of file Potion.java.

References org.bukkit.inventory.ItemStack.getType(), org.bukkit.Material.POTION, org.bukkit.inventory.ItemStack.setDurability(), and org.bukkit.potion.Potion.toDamageValue().

void org.bukkit.potion.Potion.apply ( LivingEntity  to)

Applies the effects that would be applied by this potion to the given LivingEntity.

See Also
LivingEntity::addPotionEffects(Collection)
Parameters
toThe entity to apply the effects to

Definition at line 153 of file Potion.java.

References org.bukkit.entity.LivingEntity.addPotionEffects(), and org.bukkit.potion.Potion.getEffects().

boolean org.bukkit.potion.Potion.equals ( Object  obj)
Potion org.bukkit.potion.Potion.extend ( )

Chain this to the constructor to extend the potion's duration.

Returns
The potion.

Definition at line 129 of file Potion.java.

References org.bukkit.potion.Potion.setHasExtendedDuration().

Referenced by org.bukkit.potion.Potion.fromDamage().

static Potion org.bukkit.potion.Potion.fromItemStack ( ItemStack  item)
static
static PotionBrewer org.bukkit.potion.Potion.getBrewer ( )
static

Returns an instance of PotionBrewer.

Returns
An instance of PotionBrewer

Definition at line 397 of file Potion.java.

Referenced by org.bukkit.potion.PotionEffectType.createEffect(), and org.bukkit.potion.Potion.getEffects().

Collection<PotionEffect> org.bukkit.potion.Potion.getEffects ( )

Returns a collection of PotionEffects that this Potion would confer upon a LivingEntity.

See Also
PotionBrewer::getEffectsFromDamage(int)
Potion::toDamageValue()
Returns
The effects that this potion applies

Definition at line 178 of file Potion.java.

References org.bukkit.potion.Potion.getBrewer(), org.bukkit.potion.PotionBrewer.getEffectsFromDamage(), and org.bukkit.potion.Potion.toDamageValue().

Referenced by org.bukkit.potion.Potion.apply().

int org.bukkit.potion.Potion.getLevel ( )

Returns the level of this potion.

Returns
The level of this potion

Definition at line 188 of file Potion.java.

int org.bukkit.potion.Potion.getNameId ( )

Definition at line 413 of file Potion.java.

Tier org.bukkit.potion.Potion.getTier ( )

Returns the Tier of this potion.

Returns
The tier of this potion

Definition at line 198 of file Potion.java.

References org.bukkit.potion.Potion.Tier.ONE, and org.bukkit.potion.Potion.Tier.TWO.

PotionType org.bukkit.potion.Potion.getType ( )

Returns the PotionType of this potion.

Returns
The type of this potion

Definition at line 207 of file Potion.java.

boolean org.bukkit.potion.Potion.hasExtendedDuration ( )

Returns whether this potion has an extended duration.

Returns
Whether this potion has extended duration

Definition at line 216 of file Potion.java.

int org.bukkit.potion.Potion.hashCode ( )

Definition at line 221 of file Potion.java.

References org.bukkit.potion.Potion.splash().

boolean org.bukkit.potion.Potion.isSplash ( )

Returns whether this potion is a splash potion.

Returns
Whether this is a splash potion

Definition at line 235 of file Potion.java.

References org.bukkit.potion.Potion.splash().

Referenced by org.bukkit.potion.Potion.setSplash().

void org.bukkit.potion.Potion.setHasExtendedDuration ( boolean  isExtended)

Set whether this potion has extended duration.

This will cause the potion to have roughly 8/3 more duration than a regular potion.

Parameters
isExtendedWhether the potion should have extended duration

Definition at line 245 of file Potion.java.

References org.bukkit.potion.PotionType.isInstant().

Referenced by org.bukkit.potion.Potion.extend().

void org.bukkit.potion.Potion.setLevel ( int  level)

Sets the level of this potion.

Parameters
levelThe new level of this potion

Definition at line 288 of file Potion.java.

References org.bukkit.potion.PotionType.getMaxLevel().

static void org.bukkit.potion.Potion.setPotionBrewer ( PotionBrewer  other)
static

Sets the current instance of PotionBrewer.

Generally not to be used from within a plugin.

Parameters
otherThe new PotionBrewer

Definition at line 407 of file Potion.java.

void org.bukkit.potion.Potion.setSplash ( boolean  isSplash)

Sets whether this potion is a splash potion.

Splash potions can be thrown for a radius effect.

Parameters
isSplashWhether this is a splash potion

Definition at line 257 of file Potion.java.

References org.bukkit.potion.Potion.isSplash(), and org.bukkit.potion.Potion.splash().

Referenced by org.bukkit.potion.Potion.splash().

void org.bukkit.potion.Potion.setTier ( Tier  tier)

Sets the Tier of this potion.

Parameters
tierThe new tier of this potion
Deprecated:
In favour of setLevel(int)

Definition at line 268 of file Potion.java.

References org.bukkit.potion.Potion.Tier.TWO.

void org.bukkit.potion.Potion.setType ( PotionType  type)

Sets the PotionType of this potion.

Parameters
typeThe new type of this potion

Definition at line 279 of file Potion.java.

Potion org.bukkit.potion.Potion.splash ( )
short org.bukkit.potion.Potion.toDamageValue ( )

Converts this potion to a valid potion damage short, usable for potion item stacks.

Returns
The damage value of this potion

Definition at line 301 of file Potion.java.

References org.bukkit.potion.PotionType.getDamageValue(), org.bukkit.potion.Potion.splash(), and org.bukkit.potion.PotionType.WATER.

Referenced by org.bukkit.potion.Potion.apply(), org.bukkit.potion.Potion.getEffects(), and org.bukkit.potion.Potion.toItemStack().

ItemStack org.bukkit.potion.Potion.toItemStack ( int  amount)

Converts this potion to an ItemStack with the specified amount and a correct damage value.

Parameters
amountThe amount of the ItemStack
Returns
The created ItemStack

Definition at line 329 of file Potion.java.

References org.bukkit.Material.POTION, and org.bukkit.potion.Potion.toDamageValue().


The documentation for this class was generated from the following file: