Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat query is not setting the open player interface back #8

Closed
FllipEis opened this issue Jul 5, 2024 · 1 comment
Closed

Chat query is not setting the open player interface back #8

FllipEis opened this issue Jul 5, 2024 · 1 comment

Comments

@FllipEis
Copy link
Contributor

FllipEis commented Jul 5, 2024

I'm currently experiencing an issue where, when I execute a chat query from a combined interface, the previously opened player interface is set to null and if you now close the combined interface after the query has been completed, the player interface is not being opened.
I discovered that the InterfacesListeners#startChatQuery function is invalidating the openPlayerInterfaceViews cache and failing to restore it to its original view after the query is finished. (see here).

My suggestion is to store the opened player interface in the ChatQuery data class and then return it to the cache once the query has been completed. I am also willing to create a pull request for this.

If you don't want to do that, I would like to ask what your recommended way is, to run a chat query and then open the correct player interface again (after closing the combined interface)?

My workaround is something like this, but it feels not that clean:

val currentPlayerInterface = InterfacesListeners.INSTANCE.getOpenInterface(player.uniqueId) ?: return@StaticElement

view.runChatQuery(
    onCancel = {
        CoroutineScope(Dispatchers.Default).launch {
            InterfacesListeners.INSTANCE.setOpenInterface(player.uniqueId, currentPlayerInterface)
        }
    }
) {
    CoroutineScope(Dispatchers.Default).launch {
        InterfacesListeners.INSTANCE.setOpenInterface(player.uniqueId, currentPlayerInterface)
    }
}
@Aeltumn
Copy link
Member

Aeltumn commented Jul 14, 2024

This should be fixed in the next update. There was an issue in v1.1.10 where starting a new chat query incorrectly instantly ended the chat query, which is causing the open interface to be lost. I've fixed this and brought it back to its original behavior of re-opening the previous view after the query completes.

@Aeltumn Aeltumn closed this as completed Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants