程序包 org.bukkit.event.entity

# 枚举 EntityTargetEvent.TargetReason

java.lang.Object
java.lang.Enum<EntityTargetEvent.TargetReason>
org.bukkit.event.entity.EntityTargetEvent.TargetReason

所有已实现的接口:
  `Serializable`, `Comparable<EntityTargetEvent.TargetReason>`, `Constable`

封闭类:
  EntityTargetEvent

public static enum EntityTargetEvent.TargetReason extends Enum<EntityTargetEvent.TargetReason>
An enum to specify the reason for the targeting

- ## 嵌套类概要

  ## 从类继承的嵌套类/接口 java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## 枚举常量概要

  枚举常量
  枚举常量
  说明
  `CLOSEST_ENTITY`
  When the entity doesn't have a target, so it attacks the nearest entity
  `CLOSEST_PLAYER`
  When the entity doesn't have a target, so it attacks the nearest player
  `COLLISION`
  When an entity targets another entity after colliding with it.
  `CUSTOM`
  For custom calls to the event.
  `DEFEND_VILLAGE`
  When an entity selects a target while defending a village.
  `FOLLOW_LEADER`
  When a raiding entity selects the same target as one of its compatriots.
  `FORGOT_TARGET`
  When the target is forgotten for whatever reason.
  `OWNER_ATTACKED_TARGET`
  When the owner of the entity attacks the target attacks, so the entity targets it.
  `PIG_ZOMBIE_TARGET`
  已过时。
  obsoleted by `TARGET_ATTACKED_NEARBY_ENTITY`
  `RANDOM_TARGET`
  When the entity has no target, so the entity randomly chooses one.
  `REINFORCEMENT_TARGET`
  When a zombie targeting an entity summons reinforcements, so the reinforcements target the same entity
  `TARGET_ATTACKED_ENTITY`
  When the target attacks the entity, so entity targets it
  `TARGET_ATTACKED_NEARBY_ENTITY`
  When the target attacks a nearby entity of the same type, so the entity targets it
  `TARGET_ATTACKED_OWNER`
  When the target attacks the owner of the entity, so the entity targets it.
  `TARGET_DIED`
  When the entity's target has died, and so it no longer targets it
  `TEMPT`
  When another entity tempts this entity by having a desired item such as wheat in it's hand.
  `UNKNOWN`
  A currently unknown reason for the entity changing target.

- ## 方法概要

  修饰符和类型
  方法
  说明
  `static EntityTargetEvent.TargetReason`
  `valueOf(String name)`
  返回带有指定名称的该类型的枚举常量。
  `static EntityTargetEvent.TargetReason[]`
  `values()`
  按照声明该枚举类型的常量的顺序, 返回一个包含这些常量的数组。

  ### 从类继承的方法 java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### 从类继承的方法 java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## 枚举常量详细资料

  - ### TARGET_DIED

    public static final EntityTargetEvent.TargetReason TARGET_DIED
    When the entity's target has died, and so it no longer targets it

  - ### CLOSEST_PLAYER

    public static final EntityTargetEvent.TargetReason CLOSEST_PLAYER
    When the entity doesn't have a target, so it attacks the nearest player

  - ### TARGET_ATTACKED_ENTITY

    public static final EntityTargetEvent.TargetReason TARGET_ATTACKED_ENTITY
    When the target attacks the entity, so entity targets it

  - ### PIG_ZOMBIE_TARGET

    @Deprecated public static final EntityTargetEvent.TargetReason PIG_ZOMBIE_TARGET
    已过时。
    obsoleted by `TARGET_ATTACKED_NEARBY_ENTITY`
    When the target attacks a fellow pig zombie, so the whole group will target him with this reason.

  - ### FORGOT_TARGET

    public static final EntityTargetEvent.TargetReason FORGOT_TARGET
    When the target is forgotten for whatever reason.

  - ### TARGET_ATTACKED_OWNER

    public static final EntityTargetEvent.TargetReason TARGET_ATTACKED_OWNER
    When the target attacks the owner of the entity, so the entity targets it.

  - ### OWNER_ATTACKED_TARGET

    public static final EntityTargetEvent.TargetReason OWNER_ATTACKED_TARGET
    When the owner of the entity attacks the target attacks, so the entity targets it.

  - ### RANDOM_TARGET

    public static final EntityTargetEvent.TargetReason RANDOM_TARGET
    When the entity has no target, so the entity randomly chooses one.

  - ### DEFEND_VILLAGE

    public static final EntityTargetEvent.TargetReason DEFEND_VILLAGE
    When an entity selects a target while defending a village.

  - ### TARGET_ATTACKED_NEARBY_ENTITY

    public static final EntityTargetEvent.TargetReason TARGET_ATTACKED_NEARBY_ENTITY
    When the target attacks a nearby entity of the same type, so the entity targets it

  - ### REINFORCEMENT_TARGET

    public static final EntityTargetEvent.TargetReason REINFORCEMENT_TARGET
    When a zombie targeting an entity summons reinforcements, so the reinforcements target the same entity

  - ### COLLISION

    public static final EntityTargetEvent.TargetReason COLLISION
    When an entity targets another entity after colliding with it.

  - ### CUSTOM

    public static final EntityTargetEvent.TargetReason CUSTOM
    For custom calls to the event.

  - ### CLOSEST_ENTITY

    public static final EntityTargetEvent.TargetReason CLOSEST_ENTITY
    When the entity doesn't have a target, so it attacks the nearest entity

  - ### FOLLOW_LEADER

    public static final EntityTargetEvent.TargetReason FOLLOW_LEADER
    When a raiding entity selects the same target as one of its compatriots.

  - ### TEMPT

    public static final EntityTargetEvent.TargetReason TEMPT
    When another entity tempts this entity by having a desired item such as wheat in it's hand.

  - ### UNKNOWN

    public static final EntityTargetEvent.TargetReason UNKNOWN
    A currently unknown reason for the entity changing target.

- ## 方法详细资料

  - ### values

    public static EntityTargetEvent.TargetReason[] values()
    按照声明该枚举类型的常量的顺序, 返回一个包含这些常量的数组。
    返回:
      按照声明该枚举类型的常量的顺序返回的包含这些常量的数组

  - ### valueOf

    public static EntityTargetEvent.TargetReason valueOf(String name)
    返回带有指定名称的该类型的枚举常量。 字符串必须与用于声明该类型的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)
    参数:
      `name` - 要返回的枚举常量的名称。
    返回:
      返回带有指定名称的枚举常量
    抛出:
      `IllegalArgumentException` - 如果该枚举类型没有带有指定名称的常量
      `NullPointerException` - 如果参数为空值