/** * Create a new handler list and initialize using EventPriority. The HandlerList is then added to * meta-list for use in bakeAll() * * @param allowExecutor indicating weather an executor is allowed for this event. */ public HandlerList(boolean allowExecutor) { handlerslots = new EnumMap<EventPriority, ArrayList<RegisteredListener>>(EventPriority.class); this.allowExecutor = allowExecutor; for (EventPriority o : EventPriority.values()) { if (o == EventPriority.EXECUTOR) { if (allowExecutor == true) { handlerslots.put(o, new ArrayList<RegisteredListener>(1)); } else { handlerslots.put(o, new ArrayList<RegisteredListener>(0)); } } else { handlerslots.put(o, new ArrayList<RegisteredListener>()); } } synchronized (allLists) { allLists.add(this); } }