@Target(value=METHOD) @Retention(value=RUNTIME) public @interface EventHandler
一个处理器的重要程度被称作处理器的优先级,优先级高的处理器有更多的决定权。参见: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().
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
ignoreCancelled
定义这个处理器是否忽略被取消的事件。
Define if the handler ignores a cancelled event. |
EventPriority |
priority
定义这个处理器的优先级。
Define the priority of the handler. |
public abstract EventPriority priority
Nukkit调用处理器时会按照优先级从低到高的顺序调用,这样保证了高优先级的监听器能覆盖低优先级监听器做出的处理。
调用的先后顺序如下:
EventHandlerpublic abstract boolean ignoreCancelled
如果为true而且事件发生,这个处理器不会被调用,反之相反。
If ignoreCancelled is true and the event is cancelled, the method is
not called. Otherwise, the method is always called.
EventHandlerCopyright © 2020. All rights reserved.