Skip to content

Dialog API "Requiring the player to agree before allowing them to join" should be updated to include handling if the user leaves the server during configuration #655

@MrPowerGamerBR

Description

@MrPowerGamerBR

If a user leaves during configuration phase...

  1. the thread will be blocked forever if the user leaves the server
  2. the awaitingResponse map will leak memory if the user leaves the server

I think the example should be updated accordingly to be clearer on how you handle resource clean up.

One way (recommended by emily) is by using the PlayerConnectionCloseEvent, however there isn't a easy to bind a connection in the AsyncPlayerConnectionConfigureEvent to the PlayerConnectionCloseEvent (the only way would be via the Player's UUID, however the only way to get the player's UUID in AsyncPlayerConnectionConfigureEvent is deprecated)

By the way: When testing this, DO NOT use the "warning icon" -> "Disconnect" option, it seems that there's a client bug that does not close the server connection during the configuration phase when using that button.

https://docs.papermc.io/paper/dev/dialogs/#example-a-blocking-confirmation-dialog

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions