Skip to content

Commit 3316097

Browse files
committed
feature: Allow specifying whether a chat query should re-open the view
1 parent 66aa972 commit 3316097

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

interfaces/src/main/kotlin/com/noxcrew/interfaces/InterfacesListeners.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
133133
private data class ChatQuery(
134134
val view: InterfaceView,
135135
val onCancel: suspend () -> Unit,
136-
val onComplete: suspend (Component) -> Unit,
136+
val onComplete: suspend (Component) -> Boolean,
137137
val id: UUID
138138
)
139139

@@ -499,8 +499,9 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
499499

500500
// Complete the query and re-open the view
501501
SCOPE.launch {
502-
query.onComplete(event.message())
503-
query.view.open()
502+
if (query.onComplete(event.message())) {
503+
query.view.open()
504+
}
504505
}
505506

506507
// Prevent the message from sending
@@ -641,7 +642,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
641642
view: InterfaceView,
642643
timeout: Duration,
643644
onCancel: suspend () -> Unit,
644-
onComplete: suspend (Component) -> Unit
645+
onComplete: suspend (Component) -> Boolean
645646
) {
646647
// Determine if the player has this inventory open
647648
if (!view.isOpen()) return

0 commit comments

Comments
 (0)