From 2fd21151ce1bcdc2a19e2fcff4c5e7100db4bbbe Mon Sep 17 00:00:00 2001 From: Distractic Date: Sat, 23 Dec 2023 07:28:39 +0100 Subject: [PATCH] chore: Remove await cancellation --- src/main/kotlin/com/github/rushyverse/api/gui/GUI.kt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/kotlin/com/github/rushyverse/api/gui/GUI.kt b/src/main/kotlin/com/github/rushyverse/api/gui/GUI.kt index e9c03500..ad0f2f63 100644 --- a/src/main/kotlin/com/github/rushyverse/api/gui/GUI.kt +++ b/src/main/kotlin/com/github/rushyverse/api/gui/GUI.kt @@ -7,7 +7,6 @@ import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job -import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.asFlow @@ -264,12 +263,7 @@ public abstract class GUI( // Will fill the inventory bit by bit. inventoryFlowItems.collect { (index, item) -> inventory.setItem(index, item) } } else { - val loadingAnimationJob = launch { - loadingAnimation.loading(key, inventory) - // If the loading function is finished, the "loading" state must be continued - // until the flow is finished. - awaitCancellation() - } + val loadingAnimationJob = launch { loadingAnimation.loading(key, inventory) } // To avoid conflicts with the loading animation, // we need to store the items in a temporary inventory