Annotation Interface EventHandler


@Target(METHOD) @Retention(RUNTIME) public @interface EventHandler
定义一个事件的处理器的注解。
Annotation that defines a handler.

一个处理器的重要程度被称作处理器的优先级,优先级高的处理器有更多的决定权。参见:priority()
The importance of a handler is called its priority, handlers with higher priority speaks louder then lower ones. See: priority()

处理器可以选择忽略或不忽略被取消的事件,这种特性可以在ignoreCancelled()中定义。
A handler can choose to ignore a cancelled event or not, that can be defined in ignoreCancelled().

Since:
Nukkit 1.0 | Nukkit API 1.0.0
Author:
MagicDroidX(code) @ Nukkit Project, null(javadoc) @ Nukkit Project
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    定义这个处理器是否忽略被取消的事件。
    Define if the handler ignores a cancelled event.
    定义这个处理器的优先级。
    Define the priority of the handler.
  • Element Details

    • priority

      EventPriority priority
      定义这个处理器的优先级。
      Define the priority of the handler.

      Nukkit调用处理器时会按照优先级从低到高的顺序调用,这样保证了高优先级的监听器能覆盖低优先级监听器做出的处理。 调用的先后顺序如下:

      When Nukkit calls all handlers, ones with lower priority is called earlier, that make handlers with higher priority can replace the decisions made by lower ones. The order that Nukkit call handlers is from the first to the last as:
      1. EventPriority.LOWEST
      2. EventPriority.LOW
      3. EventPriority.NORMAL
      4. EventPriority.HIGH
      5. EventPriority.HIGHEST
      6. EventPriority.MONITOR
      Returns:
      这个处理器的优先级。
      The priority of this handler.
      See Also:
      Default:
      NORMAL
    • ignoreCancelled

      boolean ignoreCancelled
      定义这个处理器是否忽略被取消的事件。
      Define if the handler ignores a cancelled event.

      如果为true而且事件发生,这个处理器不会被调用,反之相反。
      If ignoreCancelled is true and the event is cancelled, the method is not called. Otherwise, the method is always called.

      Returns:
      这个处理器是否忽略被取消的事件。
      Whether cancelled events should be ignored.
      See Also:
      Default:
      false