package com.home.clicker.events;

import java.util.HashMap;
import java.util.Map;

/**
 * Exslims
 * 08.12.2016
 */
public class EventRouter {
    private static final Map<Class, SCEventHandler> eventHandlerMap = new HashMap<Class, SCEventHandler>();
    public static void fireEvent(SCEvent SCEvent){
        eventHandlerMap.get(SCEvent.getClass()).handle(SCEvent);
    }
    public static void registerHandler(Class eventClass, SCEventHandler handler){
        eventHandlerMap.put(eventClass,handler);
    }
}

@@ -44,23 +44,74 @@
 va.util.
-HashMap
+ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List
 ;%0Aimport
@@ -215,32 +215,37 @@
 inal Map%3CClass, 
+List%3C
 SCEventHandler%3E 
@@ -243,16 +243,17 @@
 Handler%3E
+%3E
  eventHa
@@ -275,37 +275,16 @@
 HashMap%3C
-Class, SCEventHandler
 %3E();%0A   
@@ -321,19 +321,17 @@
 SCEvent 
-SCE
+e
 vent)%7B%0A 
@@ -328,32 +328,64 @@
  event)%7B%0A       
+ List%3CSCEventHandler%3E handlers =
  eventHandlerMap
@@ -389,19 +389,17 @@
 Map.get(
-SCE
+e
 vent.get
@@ -410,16 +410,96 @@
 s())
+;%0A        if(handlers != null) %7B%0A            handlers.forEach(handler -%3E handler
 .handle(
 SCEv
@@ -498,17 +498,26 @@
 dle(
-SCE
+e
 vent)
-;
+);%0A        %7D
 %0A   
@@ -601,16 +601,234 @@
 ndler)%7B%0A
+        List%3CSCEventHandler%3E scEventHandlers = eventHandlerMap.get(eventClass);%0A        if(scEventHandlers == null)%7B%0A            scEventHandlers = new ArrayList%3C%3E();%0A            scEventHandlers.add(handler);%0A        %7D%0A
         
@@ -858,23 +858,31 @@
 ntClass,
-h
+scEventH
 andler
+s
 );%0A    %7D

Fix NPE in EventRouter and added multiple handlers support