Add (v1) NetworkManager, Session and Transport #173
@@ -13,7 +13,7 @@ public class EventBus {
|
|||||||
@SuppressWarnings("unchecked") // This cast is safe, because handlers only get passed the type they subscribed to
|
@SuppressWarnings("unchecked") // This cast is safe, because handlers only get passed the type they subscribed to
|
||||||
public <T extends Event> void subscribe(Class<T> eventType, Consumer<T> handler) {
|
public <T extends Event> void subscribe(Class<T> eventType, Consumer<T> handler) {
|
||||||
handlers.computeIfAbsent(eventType, k -> new CopyOnWriteArrayList<>())
|
handlers.computeIfAbsent(eventType, k -> new CopyOnWriteArrayList<>())
|
||||||
.add((Consumer<Object>) handler);
|
.add((Consumer<Object>) (Consumer<?>) handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Event> void publish(T event) {
|
public <T extends Event> void publish(T event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user