示例#1
0
 public void registerEvents(Listener l) {
   for (Map.Entry<Class<? extends Event>, Set<RegisteredListener>> entry :
       addMuffins(l).entrySet()) {
     try {
       getEventListeners(getRegistrationClass(entry.getKey())).registerAll(entry.getValue());
     } catch (IllegalAccessException e) {
       server.Log("==!EVENT ERROR!==");
       server.logError(e);
     }
   }
 }
示例#2
0
 private EventList getEventListeners(Class<? extends Event> type) {
   try {
     Method method = getRegistrationClass(type).getDeclaredMethod("getEventList");
     method.setAccessible(true);
     return (EventList) method.invoke(null);
   } catch (Exception e) {
     server.Log("==!EVENT ERROR!==");
     server.logError(e);
     return null;
   }
 }
示例#3
0
 public void callEvent(Event event) {
   EventList events = event.getEvents();
   RegisteredListener[] listeners = events.getRegisteredListeners();
   for (RegisteredListener listen : listeners) {
     try {
       listen.execute(event);
     } catch (Exception e) {
       server.Log("==!EVENT ERROR!==");
       server.logError(e);
     }
   }
 }