aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/me/bush/illnamethislater/Event.kt
blob: 24300677e0f9b5fc0bdf42162c27af96661a1a2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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 }
}