Package org.bukkit.potion
Class PotionEffectType
java.lang.Object
org.bukkit.potion.PotionEffectType
- Direct Known Subclasses:
PotionEffectTypeWrapper
public abstract class PotionEffectType
extends java.lang.Object
Represents a type of potion and its effect on an entity.
-
Field Summary
Fields Modifier and Type Field Description static PotionEffectTypeABSORPTIONIncreases the maximum health of an entity with health that cannot be regenerated, but is refilled every 30 seconds.static PotionEffectTypeBLINDNESSBlinds an entity.static PotionEffectTypeCONFUSIONWarps vision on the client.static PotionEffectTypeDAMAGE_RESISTANCEDecreases damage dealt to an entity.static PotionEffectTypeFAST_DIGGINGIncreases dig speed.static PotionEffectTypeFIRE_RESISTANCEStops fire damage.static PotionEffectTypeHARMHurts an entity.static PotionEffectTypeHEALHeals an entity.static PotionEffectTypeHEALTH_BOOSTIncreases the maximum health of an entity.static PotionEffectTypeHUNGERIncreases hunger.static PotionEffectTypeINCREASE_DAMAGEIncreases damage dealt.static PotionEffectTypeINVISIBILITYGrants invisibility.static PotionEffectTypeJUMPIncreases jump height.static PotionEffectTypeNIGHT_VISIONAllows an entity to see in the dark.static PotionEffectTypePOISONDeals damage to an entity over time.static PotionEffectTypeREGENERATIONRegenerates health.static PotionEffectTypeSATURATIONIncreases the food level of an entity each tick.static PotionEffectTypeSLOWDecreases movement speed.static PotionEffectTypeSLOW_DIGGINGDecreases dig speed.static PotionEffectTypeSPEEDIncreases movement speed.static PotionEffectTypeWATER_BREATHINGAllows breathing underwater.static PotionEffectTypeWEAKNESSDecreases damage dealt by an entity.static PotionEffectTypeWITHERDeals damage to an entity over time and gives the health to the shooter. -
Constructor Summary
Constructors Modifier Constructor Description protectedPotionEffectType(int id) -
Method Summary
Modifier and Type Method Description PotionEffectcreateEffect(int duration, int amplifier)Creates a PotionEffect from this PotionEffectType, applying duration modifiers and checks.booleanequals(java.lang.Object obj)static PotionEffectTypegetById(int id)Deprecated.Magic valuestatic PotionEffectTypegetByName(java.lang.String name)Gets the effect type specified by the given name.abstract doublegetDurationModifier()Returns the duration modifier applied to effects of this type.intgetId()Deprecated.Magic valueabstract java.lang.StringgetName()Returns the name of this effect type.inthashCode()abstract booleanisInstant()Returns whether the effect of this type happens once, immediately.static voidregisterPotionEffectType(PotionEffectType type)Registers an effect type with the given object.static voidstopAcceptingRegistrations()Stops accepting any effect type registrations.java.lang.StringtoString()static PotionEffectType[]values()Returns an array of all the registeredPotionEffectTypes.
-
Field Details
-
SPEED
Increases movement speed. -
SLOW
Decreases movement speed. -
FAST_DIGGING
Increases dig speed. -
SLOW_DIGGING
Decreases dig speed. -
INCREASE_DAMAGE
Increases damage dealt. -
HEAL
Heals an entity. -
HARM
Hurts an entity. -
JUMP
Increases jump height. -
CONFUSION
Warps vision on the client. -
REGENERATION
Regenerates health. -
DAMAGE_RESISTANCE
Decreases damage dealt to an entity. -
FIRE_RESISTANCE
Stops fire damage. -
WATER_BREATHING
Allows breathing underwater. -
INVISIBILITY
Grants invisibility. -
BLINDNESS
Blinds an entity. -
NIGHT_VISION
Allows an entity to see in the dark. -
HUNGER
Increases hunger. -
WEAKNESS
Decreases damage dealt by an entity. -
POISON
Deals damage to an entity over time. -
WITHER
Deals damage to an entity over time and gives the health to the shooter. -
HEALTH_BOOST
Increases the maximum health of an entity. -
ABSORPTION
Increases the maximum health of an entity with health that cannot be regenerated, but is refilled every 30 seconds. -
SATURATION
Increases the food level of an entity each tick.
-
-
Constructor Details
-
PotionEffectType
protected PotionEffectType(int id)
-
-
Method Details
-
createEffect
Creates a PotionEffect from this PotionEffectType, applying duration modifiers and checks.- Parameters:
duration- time in ticksamplifier- 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 valueReturns the unique ID of this type.- Returns:
- Unique ID
-
getName
public abstract java.lang.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(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getById
Deprecated.Magic valueGets the effect type specified by the unique id.- Parameters:
id- Unique ID to fetch- Returns:
- Resulting type, or null if not found.
-
getByName
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
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
Returns an array of all the registeredPotionEffectTypes.- Returns:
- Array of types.
-