org.bukkit.event.EventHandler.priority()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.bukkit.event.EventHandler.priority()方法的一些代码示例,展示了EventHandler.priority()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EventHandler.priority()方法的具体详情如下:
包路径:org.bukkit.event.EventHandler
类名称:EventHandler
方法名:priority

EventHandler.priority介绍

暂无

代码示例

代码示例来源:origin: Bukkit/Bukkit

eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
} else {
  eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));

代码示例来源:origin: NoCheatPlus/NoCheatPlus

@Override
protected EventPriority getPriority(Method method, EventPriority defaultPriority) {
  EventHandler info = method.getAnnotation(EventHandler.class);
  if (info == null) {
    return defaultPriority;
  }
  else {
    return info.priority();
  }
}

代码示例来源:origin: NoCheatPlus/NoCheatPlus

/**
 * Convenience method for component registration. Use @EventHandler to
 * specify EventPriority and ignoreCancelled. See
 * {@link fr.neatmonster.nocheatplus.event.mini.MiniListenerRegistry#register(Class, MiniListener, Object, RegistrationOrder, boolean)}
 * for reference on how to set up order.
 * 
 * @param eventClass Type of event to register for.
 * @param listener
 * @throws IllegalArgumentException
 *             If @EventHandler is not present or mismatching types.
 */
@SuppressWarnings("unchecked")
public <E extends Event> void register(Class<E> eventClass, MiniListener<E> listener) {
  final Class<MiniListener<E>> clazz = (Class<MiniListener<E>>) listener.getClass();
  EventHandler eh;
  try {
    Method method = clazz.getMethod("onEvent", eventClass);
    if (!method.isAnnotationPresent(EventHandler.class)) {
      throw new IllegalArgumentException("Must have @EventHandler annotation: " + clazz.getName());
    }
    eh = method.getAnnotation(EventHandler.class);
    eventClass = (Class<E>) method.getParameterTypes()[0];
  } catch (NoSuchMethodException e) {
    throw new IllegalArgumentException(e);
  } catch (SecurityException e) {
    throw new IllegalArgumentException(e);
  }
  register(eventClass, listener, eh.priority(), null, eh.ignoreCancelled());
}

代码示例来源:origin: SpigotMC/Spigot-API

eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
} else {
  eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));

代码示例来源:origin: EngineHub/CommandHelper

Class<? extends Event> eventClass;
if(defaultHandler != null) {
  priority = defaultHandler.priority();

相关文章