From 0c16dc9ff4e99a70704da74b384c9a6d49f9fc38 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Wed, 23 Aug 2023 23:25:17 +0200 Subject: chore: moved back the only remaining annotation --- .../java/ftbsc/geb/api/annotations/Listen.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/ftbsc/geb/api/annotations/Listen.java diff --git a/src/main/java/ftbsc/geb/api/annotations/Listen.java b/src/main/java/ftbsc/geb/api/annotations/Listen.java new file mode 100644 index 0000000..a3643bf --- /dev/null +++ b/src/main/java/ftbsc/geb/api/annotations/Listen.java @@ -0,0 +1,29 @@ +package ftbsc.geb.api.annotations; + +import ftbsc.geb.api.IBus; +import ftbsc.geb.api.IEvent; +import ftbsc.geb.api.IEventCancelable; +import ftbsc.geb.api.IListener; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marks the method as a listener. 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}. + * For the annotation to work, you must be using the GEB annotation processor or an equivalent. + * @since 0.1.0 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.CLASS) +public @interface Listen { + /** + * @return an integer indicating priority level for the listener, defaulting to 0; + * a higher value means it's executed before; it may be negative + */ + int priority() default 0; +} -- cgit v1.2.3-56-ga3b1