aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/me/bush/illnamethislater/Event.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/me/bush/illnamethislater/Event.kt')
-rw-r--r--src/main/kotlin/me/bush/illnamethislater/Event.kt16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/kotlin/me/bush/illnamethislater/Event.kt b/src/main/kotlin/me/bush/illnamethislater/Event.kt
index 2430067..39360eb 100644
--- a/src/main/kotlin/me/bush/illnamethislater/Event.kt
+++ b/src/main/kotlin/me/bush/illnamethislater/Event.kt
@@ -3,9 +3,17 @@ package me.bush.illnamethislater
/**
* A base class for events that can be cancelled.
*
+ * If [cancellable] is true, your event can be [cancelled].
+ *
+ * If [cancelled] is true, listeners with lower priority will not receive it unless:
+ * * They have [Listener.receiveCancelled] set to `true`.
+ * * A future listener with [Listener.receiveCancelled] sets [cancelled] to `false`
+ *
* @author bush
- * @since 3/13/2022
+ * @since 1.0.0
*/
+// TODO: 3/27/2022 ducks or a way to cancel anything (can't put a custom annotation on forge events)
+// store cancellable info at subscribe time, do not calculate it in post
abstract class Event {
var cancelled = false
set(value) {
@@ -14,5 +22,7 @@ abstract class Event {
abstract val cancellable: Boolean
- fun cancel() { cancelled = false }
-} \ No newline at end of file
+ fun cancel() {
+ cancelled = false
+ }
+}