类 PotionEffect

java.lang.Object
org.bukkit.potion.PotionEffect
所有已实现的接口:
ConfigurationSerializable

public class PotionEffect extends Object implements 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

      public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, Color color)
      Creates a potion effect.
      参数:
      type - effect type
      duration - measured in ticks, see getDuration()
      amplifier - the amplifier, see getAmplifier()
      ambient - the ambient status, see isAmbient()
      particles - the particle status, see hasParticles()
      color - the particle color, see getColor()
    • PotionEffect

      public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles)
      Creates a potion effect with no defined color.
      参数:
      type - effect type
      duration - measured in ticks, see getDuration()
      amplifier - the amplifier, see getAmplifier()
      ambient - the ambient status, see isAmbient()
      particles - the particle status, see hasParticles()
    • PotionEffect

      public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient)
      Creates a potion effect. Assumes that particles are visible
      参数:
      type - effect type
      duration - measured in ticks, see getDuration()
      amplifier - the amplifier, see getAmplifier()
      ambient - the ambient status, see isAmbient()
    • PotionEffect

      public PotionEffect(PotionEffectType type, int duration, int amplifier)
      Creates a potion effect. Assumes ambient is true.
      参数:
      type - Effect type
      duration - measured in ticks
      amplifier - the amplifier for the effect
      另请参阅:
    • PotionEffect

      public PotionEffect(Map<String,Object> map)
      Constructor for deserialization.
      参数:
      map - the map to deserialize from
  • 方法详细资料

    • serialize

      public Map<String,Object> 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

      public boolean apply(LivingEntity entity)
      Attempts to add the effect represented by this object to the given LivingEntity.
      参数:
      entity - The entity to add this effect to
      返回:
      Whether the effect could be added
      另请参阅:
    • equals

      public boolean equals(Object obj)
      覆盖:
      equals 在类中 Object
    • 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 a LivingEntity.
      返回:
      The duration of the effect
    • getType

      public PotionEffectType getType()
      Returns the PotionEffectType 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

      public Color getColor()
      返回:
      color of this potion's particles. May be null if the potion has no particles or defined color.
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object