org.bukkit.potion
Class PotionEffectType

java.lang.Object
  extended by org.bukkit.potion.PotionEffectType
Direct Known Subclasses:
PotionEffectTypeWrapper

public abstract class PotionEffectType
extends Object

Represents a type of potion and its effect on an entity.


Field Summary
static PotionEffectType ABSORPTION
          Increases the maximum health of an entity with health that cannot be regenerated, but is refilled every 30 seconds.
static PotionEffectType BLINDNESS
          Blinds an entity.
static PotionEffectType CONFUSION
          Warps vision on the client.
static PotionEffectType DAMAGE_RESISTANCE
          Decreases damage dealt to an entity.
static PotionEffectType FAST_DIGGING
          Increases dig speed.
static PotionEffectType FIRE_RESISTANCE
          Stops fire damage.
static PotionEffectType HARM
          Hurts an entity.
static PotionEffectType HEAL
          Heals an entity.
static PotionEffectType HEALTH_BOOST
          Increases the maximum health of an entity.
static PotionEffectType HUNGER
          Increases hunger.
static PotionEffectType INCREASE_DAMAGE
          Increases damage dealt.
static PotionEffectType INVISIBILITY
          Grants invisibility.
static PotionEffectType JUMP
          Increases jump height.
static PotionEffectType NIGHT_VISION
          Allows an entity to see in the dark.
static PotionEffectType POISON
          Deals damage to an entity over time.
static PotionEffectType REGENERATION
          Regenerates health.
static PotionEffectType SATURATION
          Increases the food level of an entity each tick.
static PotionEffectType SLOW
          Decreases movement speed.
static PotionEffectType SLOW_DIGGING
          Decreases dig speed.
static PotionEffectType SPEED
          Increases movement speed.
static PotionEffectType WATER_BREATHING
          Allows breathing underwater.
static PotionEffectType WEAKNESS
          Decreases damage dealt by an entity.
static PotionEffectType WITHER
          Deals damage to an entity over time and gives the health to the shooter.
 
Constructor Summary
protected PotionEffectType(int id)
           
 
Method Summary
 PotionEffect createEffect(int duration, int amplifier)
          Creates a PotionEffect from this PotionEffectType, applying duration modifiers and checks.
 boolean equals(Object obj)
           
static PotionEffectType getById(int id)
          Deprecated. Magic value
static PotionEffectType getByName(String name)
          Gets the effect type specified by the given name.
abstract  double getDurationModifier()
          Returns the duration modifier applied to effects of this type.
 int getId()
          Deprecated. Magic value
abstract  String getName()
          Returns the name of this effect type.
 int hashCode()
           
abstract  boolean isInstant()
          Returns whether the effect of this type happens once, immediately.
static void registerPotionEffectType(PotionEffectType type)
          Registers an effect type with the given object.
static void stopAcceptingRegistrations()
          Stops accepting any effect type registrations.
 String toString()
           
static PotionEffectType[] values()
          Returns an array of all the registered PotionEffectTypes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SPEED

public static final PotionEffectType SPEED
Increases movement speed.


SLOW

public static final PotionEffectType SLOW
Decreases movement speed.


FAST_DIGGING

public static final PotionEffectType FAST_DIGGING
Increases dig speed.


SLOW_DIGGING

public static final PotionEffectType SLOW_DIGGING
Decreases dig speed.


INCREASE_DAMAGE

public static final PotionEffectType INCREASE_DAMAGE
Increases damage dealt.


HEAL

public static final PotionEffectType HEAL
Heals an entity.


HARM

public static final PotionEffectType HARM
Hurts an entity.


JUMP

public static final PotionEffectType JUMP
Increases jump height.


CONFUSION

public static final PotionEffectType CONFUSION
Warps vision on the client.


REGENERATION

public static final PotionEffectType REGENERATION
Regenerates health.


DAMAGE_RESISTANCE

public static final PotionEffectType DAMAGE_RESISTANCE
Decreases damage dealt to an entity.


FIRE_RESISTANCE

public static final PotionEffectType FIRE_RESISTANCE
Stops fire damage.


WATER_BREATHING

public static final PotionEffectType WATER_BREATHING
Allows breathing underwater.


INVISIBILITY

public static final PotionEffectType INVISIBILITY
Grants invisibility.


BLINDNESS

public static final PotionEffectType BLINDNESS
Blinds an entity.


NIGHT_VISION

public static final PotionEffectType NIGHT_VISION
Allows an entity to see in the dark.


HUNGER

public static final PotionEffectType HUNGER
Increases hunger.


WEAKNESS

public static final PotionEffectType WEAKNESS
Decreases damage dealt by an entity.


POISON

public static final PotionEffectType POISON
Deals damage to an entity over time.


WITHER

public static final PotionEffectType WITHER
Deals damage to an entity over time and gives the health to the shooter.


HEALTH_BOOST

public static final PotionEffectType HEALTH_BOOST
Increases the maximum health of an entity.


ABSORPTION

public static final PotionEffectType ABSORPTION
Increases the maximum health of an entity with health that cannot be regenerated, but is refilled every 30 seconds.


SATURATION

public static final PotionEffectType SATURATION
Increases the food level of an entity each tick.

Constructor Detail

PotionEffectType

protected PotionEffectType(int id)
Method Detail

createEffect

public PotionEffect createEffect(int duration,
                                 int amplifier)
Creates a PotionEffect from this PotionEffectType, applying duration modifiers and checks.

Parameters:
duration - time in ticks
amplifier - the effect's amplifier
Returns:
a resulting potion effect
See Also:
PotionBrewer.createEffect(PotionEffectType, int, int)

getDurationModifier

public abstract double getDurationModifier()
Returns the duration modifier applied to effects of this type.

Returns:
duration modifier

getId

@Deprecated
public int getId()
Deprecated. Magic value

Returns the unique ID of this type.

Returns:
Unique ID

getName

public abstract String getName()
Returns the name of this effect type.

Returns:
The name of this effect type

isInstant

public abstract boolean isInstant()
Returns whether the effect of this type happens once, immediately.

Returns:
whether this type is normally instant

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getById

@Deprecated
public static PotionEffectType getById(int id)
Deprecated. Magic value

Gets the effect type specified by the unique id.

Parameters:
id - Unique ID to fetch
Returns:
Resulting type, or null if not found.

getByName

public static PotionEffectType getByName(String name)
Gets the effect type specified by the given name.

Parameters:
name - Name of PotionEffectType to fetch
Returns:
Resulting PotionEffectType, or null if not found.

registerPotionEffectType

public static void registerPotionEffectType(PotionEffectType type)
Registers an effect type with the given object.

Generally not to be used from within a plugin.

Parameters:
type - PotionType to register

stopAcceptingRegistrations

public static void stopAcceptingRegistrations()
Stops accepting any effect type registrations.


values

public static PotionEffectType[] values()
Returns an array of all the registered PotionEffectTypes.

Returns:
Array of types.


Copyright © 2013. All Rights Reserved.