org.bukkit.potion
Class Potion

java.lang.Object
  extended by org.bukkit.potion.Potion

public class Potion
extends Object

Represents a minecraft potion


Nested Class Summary
static class Potion.Tier
          Deprecated. 
 
Constructor Summary
Potion(int name)
          Create a potion with a specific name.
Potion(PotionType type)
          Construct a new potion of the given type.
Potion(PotionType type, int level)
          Create a new potion of the given type and level.
Potion(PotionType type, int level, boolean splash)
          Deprecated. In favour of using Potion(PotionType) with splash().
Potion(PotionType type, int level, boolean splash, boolean extended)
          Deprecated. In favour of using Potion(PotionType) with extend() and possibly splash().
Potion(PotionType type, Potion.Tier tier)
          Deprecated. In favour of Potion(PotionType, int)
Potion(PotionType type, Potion.Tier tier, boolean splash)
          Deprecated. In favour of Potion(PotionType, int, boolean)
Potion(PotionType type, Potion.Tier tier, boolean splash, boolean extended)
          Deprecated. In favour of Potion(PotionType, int, boolean, boolean)
 
Method Summary
 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)
           
 Potion extend()
          Chain this to the constructor to extend the potion's duration.
static Potion fromDamage(int damage)
          Deprecated. Magic value
static Potion fromItemStack(ItemStack item)
           
static PotionBrewer getBrewer()
          Returns an instance of PotionBrewer.
 Collection<PotionEffect> getEffects()
          Returns a collection of PotionEffects that this Potion would confer upon a LivingEntity.
 int getLevel()
          Returns the level of this potion.
 int getNameId()
          Deprecated. Magic value
 Potion.Tier getTier()
          Deprecated. 
 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 setLevel(int level)
          Sets the level of this potion.
static void setPotionBrewer(PotionBrewer other)
          Sets the current instance of PotionBrewer.
 void setSplash(boolean isSplash)
          Sets whether this potion is a splash potion.
 void setTier(Potion.Tier tier)
          Deprecated. In favour of setLevel(int)
 void setType(PotionType type)
          Sets the PotionType of this potion.
 Potion splash()
          Chain this to the constructor to make the potion a splash potion.
 short toDamageValue()
          Deprecated. Magic value
 ItemStack toItemStack(int amount)
          Converts this potion to an ItemStack with the specified amount and a correct damage value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Potion

public 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:
type - The potion type
See Also:
Potion(int)

Potion

@Deprecated
public Potion(PotionType type,
                         Potion.Tier tier)
Deprecated. In favour of Potion(PotionType, int)


Potion

@Deprecated
public Potion(PotionType type,
                         Potion.Tier tier,
                         boolean splash)
Deprecated. In favour of Potion(PotionType, int, boolean)


Potion

@Deprecated
public Potion(PotionType type,
                         Potion.Tier tier,
                         boolean splash,
                         boolean extended)
Deprecated. In favour of Potion(PotionType, int, boolean, boolean)


Potion

public Potion(PotionType type,
              int level)
Create a new potion of the given type and level.

Parameters:
type - The type of potion.
level - The potion's level.

Potion

@Deprecated
public Potion(PotionType type,
                         int level,
                         boolean splash)
Deprecated. In favour of using Potion(PotionType) with splash().

Create a new potion of the given type and level.

Parameters:
type - The type of potion.
level - The potion's level.
splash - Whether it is a splash potion.

Potion

@Deprecated
public Potion(PotionType type,
                         int level,
                         boolean splash,
                         boolean extended)
Deprecated. In favour of using Potion(PotionType) with extend() and possibly splash().

Create a new potion of the given type and level.

Parameters:
type - The type of potion.
level - The potion's level.
splash - Whether it is a splash potion.
extended - Whether it has an extended duration.

Potion

public Potion(int name)
Create a potion with a specific name.

Parameters:
name - The name index (0-63)
Method Detail

splash

public Potion splash()
Chain this to the constructor to make the potion a splash potion.

Returns:
The potion.

extend

public Potion extend()
Chain this to the constructor to extend the potion's duration.

Returns:
The potion.

apply

public void apply(ItemStack to)
Applies the effects of this potion to the given ItemStack. The ItemStack must be a potion.

Parameters:
to - The itemstack to apply to

apply

public void apply(LivingEntity to)
Applies the effects that would be applied by this potion to the given LivingEntity.

Parameters:
to - The entity to apply the effects to
See Also:
LivingEntity.addPotionEffects(Collection)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getEffects

public Collection<PotionEffect> getEffects()
Returns a collection of PotionEffects that this Potion would confer upon a LivingEntity.

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

getLevel

public int getLevel()
Returns the level of this potion.

Returns:
The level of this potion

getTier

@Deprecated
public Potion.Tier getTier()
Deprecated. 

Returns the Potion.Tier of this potion.

Returns:
The tier of this potion

getType

public PotionType getType()
Returns the PotionType of this potion.

Returns:
The type of this potion

hasExtendedDuration

public boolean hasExtendedDuration()
Returns whether this potion has an extended duration.

Returns:
Whether this potion has extended duration

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isSplash

public boolean isSplash()
Returns whether this potion is a splash potion.

Returns:
Whether this is a splash potion

setHasExtendedDuration

public void 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:
isExtended - Whether the potion should have extended duration

setSplash

public void setSplash(boolean isSplash)
Sets whether this potion is a splash potion. Splash potions can be thrown for a radius effect.

Parameters:
isSplash - Whether this is a splash potion

setTier

@Deprecated
public void setTier(Potion.Tier tier)
Deprecated. In favour of setLevel(int)

Sets the Potion.Tier of this potion.

Parameters:
tier - The new tier of this potion

setType

public void setType(PotionType type)
Sets the PotionType of this potion.

Parameters:
type - The new type of this potion

setLevel

public void setLevel(int level)
Sets the level of this potion.

Parameters:
level - The new level of this potion

toDamageValue

@Deprecated
public short toDamageValue()
Deprecated. Magic value

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

Returns:
The damage value of this potion

toItemStack

public ItemStack toItemStack(int amount)
Converts this potion to an ItemStack with the specified amount and a correct damage value.

Parameters:
amount - The amount of the ItemStack
Returns:
The created ItemStack

fromDamage

@Deprecated
public static Potion fromDamage(int damage)
Deprecated. Magic value


fromItemStack

public static Potion fromItemStack(ItemStack item)

getBrewer

public static PotionBrewer getBrewer()
Returns an instance of PotionBrewer.

Returns:
An instance of PotionBrewer

setPotionBrewer

public static void setPotionBrewer(PotionBrewer other)
Sets the current instance of PotionBrewer. Generally not to be used from within a plugin.

Parameters:
other - The new PotionBrewer

getNameId

@Deprecated
public int getNameId()
Deprecated. Magic value



Copyright © 2014. All rights reserved.