Skip to content

Commit

Permalink
feature: Allow specifying whether a chat query should re-open the view
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeltumn committed Aug 3, 2024
1 parent 66aa972 commit 3316097
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
private data class ChatQuery(
val view: InterfaceView,
val onCancel: suspend () -> Unit,
val onComplete: suspend (Component) -> Unit,
val onComplete: suspend (Component) -> Boolean,
val id: UUID
)

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

// Complete the query and re-open the view
SCOPE.launch {
query.onComplete(event.message())
query.view.open()
if (query.onComplete(event.message())) {
query.view.open()
}
}

// Prevent the message from sending
Expand Down Expand Up @@ -641,7 +642,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
view: InterfaceView,
timeout: Duration,
onCancel: suspend () -> Unit,
onComplete: suspend (Component) -> Unit
onComplete: suspend (Component) -> Boolean
) {
// Determine if the player has this inventory open
if (!view.isOpen()) return
Expand Down

0 comments on commit 3316097

Please sign in to comment.