From 5f0fd39650659010a23055c11eae66fb3ffb2ad0 Mon Sep 17 00:00:00 2001 From: IlmarsXd Date: Thu, 29 Jun 2023 18:05:08 +0300 Subject: Fix NPE with PlaySoundEvent --- src/main/kotlin/com/dulkirfabric/events/base/CancellableEvent.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/main/kotlin/com/dulkirfabric/events') diff --git a/src/main/kotlin/com/dulkirfabric/events/base/CancellableEvent.kt b/src/main/kotlin/com/dulkirfabric/events/base/CancellableEvent.kt index 09027ed..c7c8ea6 100644 --- a/src/main/kotlin/com/dulkirfabric/events/base/CancellableEvent.kt +++ b/src/main/kotlin/com/dulkirfabric/events/base/CancellableEvent.kt @@ -4,8 +4,7 @@ import com.dulkirfabric.DulkirModFabric import meteordevelopment.orbit.ICancellable abstract class CancellableEvent: ICancellable { - @JvmField - var cancelled: Boolean = false + private var cancelled = false override fun isCancelled(): Boolean { return cancelled @@ -19,7 +18,6 @@ abstract class CancellableEvent: ICancellable { * Posts a given event to the bus and returns whether the user wishes to cancel it */ fun post(): Boolean { - DulkirModFabric.EVENT_BUS.post(this) - return cancelled + return DulkirModFabric.EVENT_BUS.post(this).isCancelled } } \ No newline at end of file -- cgit