diff options
Diffstat (limited to 'src/main/kotlin/me/bush/illnamethislater/Event.kt')
-rw-r--r-- | src/main/kotlin/me/bush/illnamethislater/Event.kt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/kotlin/me/bush/illnamethislater/Event.kt b/src/main/kotlin/me/bush/illnamethislater/Event.kt new file mode 100644 index 0000000..2430067 --- /dev/null +++ b/src/main/kotlin/me/bush/illnamethislater/Event.kt @@ -0,0 +1,18 @@ +package me.bush.illnamethislater + +/** + * A base class for events that can be cancelled. + * + * @author bush + * @since 3/13/2022 + */ +abstract class Event { + var cancelled = false + set(value) { + if (cancellable) field = value + } + + abstract val cancellable: Boolean + + fun cancel() { cancelled = false } +}
\ No newline at end of file |