fun dispatch(event: IEvent) { val eventType: Class<out IEvent?> = event.getClass() Discord4J.logger.debug("Dispatching event of type {}.", eventType.simpleName) if (listenerMap.containsKey(eventType)) { for (listener in listenerMap.get(eventType)) { listener.receive(event) } } }
Sends an IEvent to all listeners that listen for that specific event .