类 PotionEffect
java.lang.Object
org.bukkit.potion.PotionEffect
- 所有已实现的接口:
ConfigurationSerializable
Represents a potion effect, that can be added to a
LivingEntity
. A
potion effect has a duration that it will last for, an amplifier that will
enhance its effects, and a PotionEffectType
, that represents its
effect on an entity.-
构造器概要
构造器说明PotionEffect
(Map<String, Object> map) Constructor for deserialization.PotionEffect
(PotionEffectType type, int duration, int amplifier) Creates a potion effect.PotionEffect
(PotionEffectType type, int duration, int amplifier, boolean ambient) Creates a potion effect.PotionEffect
(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles) Creates a potion effect with no defined color.PotionEffect
(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, Color color) Creates a potion effect. -
方法概要
修饰符和类型方法说明boolean
apply
(LivingEntity entity) Attempts to add the effect represented by this object to the givenLivingEntity
.boolean
int
Returns the amplifier of this effect.getColor()
int
Returns the duration (in ticks) that this effect will run for when applied to aLivingEntity
.getType()
Returns thePotionEffectType
of this effect.int
hashCode()
boolean
boolean
Makes potion effect produce more, translucent, particles.Creates a Map representation of this class.toString()
-
构造器详细资料
-
PotionEffect
public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, Color color) Creates a potion effect.- 参数:
type
- effect typeduration
- measured in ticks, seegetDuration()
amplifier
- the amplifier, seegetAmplifier()
ambient
- the ambient status, seeisAmbient()
particles
- the particle status, seehasParticles()
color
- the particle color, seegetColor()
-
PotionEffect
public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles) Creates a potion effect with no defined color.- 参数:
type
- effect typeduration
- measured in ticks, seegetDuration()
amplifier
- the amplifier, seegetAmplifier()
ambient
- the ambient status, seeisAmbient()
particles
- the particle status, seehasParticles()
-
PotionEffect
Creates a potion effect. Assumes that particles are visible- 参数:
type
- effect typeduration
- measured in ticks, seegetDuration()
amplifier
- the amplifier, seegetAmplifier()
ambient
- the ambient status, seeisAmbient()
-
PotionEffect
Creates a potion effect. Assumes ambient is true.- 参数:
type
- Effect typeduration
- measured in ticksamplifier
- the amplifier for the effect- 另请参阅:
-
PotionEffect
Constructor for deserialization.- 参数:
map
- the map to deserialize from
-
-
方法详细资料
-
serialize
从接口复制的说明:ConfigurationSerializable
Creates a Map representation of this class.This class must provide a method to restore this class, as defined in the
ConfigurationSerializable
interface javadocs.- 指定者:
serialize
在接口中ConfigurationSerializable
- 返回:
- Map containing the current state of this class
-
apply
Attempts to add the effect represented by this object to the givenLivingEntity
.- 参数:
entity
- The entity to add this effect to- 返回:
- Whether the effect could be added
- 另请参阅:
-
equals
-
getAmplifier
public int getAmplifier()Returns the amplifier of this effect. A higher amplifier means the potion effect happens more often over its duration and in some cases has more effect on its target.- 返回:
- The effect amplifier
-
getDuration
public int getDuration()Returns the duration (in ticks) that this effect will run for when applied to aLivingEntity
.- 返回:
- The duration of the effect
-
getType
Returns thePotionEffectType
of this effect.- 返回:
- The potion type of this effect
-
isAmbient
public boolean isAmbient()Makes potion effect produce more, translucent, particles.- 返回:
- if this effect is ambient
-
hasParticles
public boolean hasParticles()- 返回:
- whether this effect has particles or not
-
getColor
- 返回:
- color of this potion's particles. May be null if the potion has no particles or defined color.
-
hashCode
public int hashCode() -
toString
-