aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-08-23 23:31:50 +0200
committer zaaarf <zaaarf@proton.me>2023-08-23 23:31:50 +0200
commitfd87c90d636b98f398b2f40cca83305cb0316e4e (patch)
treec11e249311240cd96a5d301e4335ccc3208db4f0
parent0c16dc9ff4e99a70704da74b384c9a6d49f9fc38 (diff)
chore: identifier leftovers0.1.4
-rw-r--r--src/main/java/ftbsc/geb/GEB.java14
-rw-r--r--src/main/java/ftbsc/geb/api/IEventDispatcher.java5
2 files changed, 5 insertions, 14 deletions
diff --git a/src/main/java/ftbsc/geb/GEB.java b/src/main/java/ftbsc/geb/GEB.java
index 58ad079..31a88c0 100644
--- a/src/main/java/ftbsc/geb/GEB.java
+++ b/src/main/java/ftbsc/geb/GEB.java
@@ -14,12 +14,6 @@ import java.util.concurrent.ConcurrentHashMap;
* @since 0.1.0
*/
public class GEB implements IBus {
-
- /**
- * The identifier of this bus. Methods
- */
- private final String identifier;
-
/**
* A {@link Map} tying each listener class to its instance.
*/
@@ -31,11 +25,9 @@ public class GEB implements IBus {
private final Map<Class<? extends IEvent>, IEventDispatcher> dispatchMap;
/**
- * The public constructor.
- * @param identifier a {@link String} uniquely identifying this bus
+ * The default public constructor.
*/
- public GEB(String identifier) {
- this.identifier = identifier;
+ public GEB() {
this.listenerMap = new ConcurrentHashMap<>();
this.dispatchMap = new ConcurrentHashMap<>();
for(IEventDispatcher dispatcher : ServiceLoader.load(IEventDispatcher.class))
@@ -58,6 +50,6 @@ public class GEB implements IBus {
*/
@Override
public boolean handleEvent(IEvent event) {
- return this.dispatchMap.get(event.getClass()).callListeners(this.identifier, event, this.listenerMap);
+ return this.dispatchMap.get(event.getClass()).callListeners(event, this.listenerMap);
}
}
diff --git a/src/main/java/ftbsc/geb/api/IEventDispatcher.java b/src/main/java/ftbsc/geb/api/IEventDispatcher.java
index 25ec657..e736706 100644
--- a/src/main/java/ftbsc/geb/api/IEventDispatcher.java
+++ b/src/main/java/ftbsc/geb/api/IEventDispatcher.java
@@ -10,13 +10,12 @@ import java.util.Map;
*/
public interface IEventDispatcher {
/**
- * Calls all listeners for the given identifier.
- * @param identifier the identifier of the bus that's calling this
+ * Calls all listeners for the given event.
* @param event the event to call
* @param listeners a map mapping each {@link IListener} class to its instance
* @return the value {@link IBus#handleEvent(IEvent)} will return for this
*/
- boolean callListeners(String identifier, IEvent event, Map<Class<? extends IListener>, IListener> listeners);
+ boolean callListeners(IEvent event, Map<Class<? extends IListener>, IListener> listeners);
/**
* @return the {@link Class} representing the event this dispatcher works with