diff options
author | zaaarf <me@zaaarf.foo> | 2024-09-01 12:54:33 +0200 |
---|---|---|
committer | zaaarf <me@zaaarf.foo> | 2024-09-01 12:54:33 +0200 |
commit | 15fd1373cef7053b1af53a98d2b476d82a4f9b65 (patch) | |
tree | 601741af488167ce838dbd6a6d7d032386789694 /src/main | |
parent | 81968f1c1685ca070a64632c047d6c1dc4a032b9 (diff) |
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/ftbsc/geb/api/IEventDispatcher.java | 7 | ||||
-rw-r--r-- | src/main/java/ftbsc/geb/api/annotations/Listen.java | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/ftbsc/geb/api/IEventDispatcher.java b/src/main/java/ftbsc/geb/api/IEventDispatcher.java index ef13f0b..c356284 100644 --- a/src/main/java/ftbsc/geb/api/IEventDispatcher.java +++ b/src/main/java/ftbsc/geb/api/IEventDispatcher.java @@ -7,19 +7,20 @@ import java.util.Set; * The interface that the generated dispatchers will all use. * This interface isn't really meant to be used by humans, but it should work if your * use case requires it. + * @param <T> the event this is for * @since 0.1.1 */ -public interface IEventDispatcher { +public interface IEventDispatcher<T extends IEvent> { /** * Calls all listeners for the given event. * @param event the event to call * @param listeners a map mapping each {@link IListener} class to its instances * @return the value {@link IBus#handleEvent(IEvent)} will return for this */ - boolean callListeners(IEvent event, Map<Class<? extends IListener>, Set<IListener>> listeners); + boolean callListeners(T event, Map<Class<? extends IListener>, Set<IListener>> listeners); /** * @return the {@link Class} representing the event this dispatcher works with */ - Class<? extends IEvent> eventType(); + Class<T> eventType(); } diff --git a/src/main/java/ftbsc/geb/api/annotations/Listen.java b/src/main/java/ftbsc/geb/api/annotations/Listen.java index a3643bf..ff00320 100644 --- a/src/main/java/ftbsc/geb/api/annotations/Listen.java +++ b/src/main/java/ftbsc/geb/api/annotations/Listen.java @@ -11,7 +11,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Marks the method as a listener. Its parent must implement the {@link IListener} interface + * Marks the method as a listener. + * If the method is not static, its parent must implement the {@link IListener} interface * and be registered an at least one GEB instance with {@link IBus#registerListener(IListener)}. * The annotated method should only take a single input value, an instance of {@link IEvent} or * {@link IEventCancelable}. |