summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-08-23 23:25:17 +0200
committer zaaarf <zaaarf@proton.me>2023-08-23 23:25:17 +0200
commit0c16dc9ff4e99a70704da74b384c9a6d49f9fc38 (patch)
tree639cde69e9326124dff2428e010b90c12cc474aa /src/main
parent4dcb9eca24583dd3df9ea644aa7f96c8e967d967 (diff)
chore: moved back the only remaining annotation0.1.3
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/ftbsc/geb/api/annotations/Listen.java29
1 files changed, 29 insertions, 0 deletions
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;
+}