Skip to content

Conversation

radek203
Copy link

Adds the setReason(Component reason) method to PlayerChooseInitialServerEvent, allowing plugins to set a custom disconnect message.

If not used, the default reason will be shown, ensuring full backward compatibility.

This is useful for plugin developers who want to display custom messages when no available servers are found for the player.

Comment on lines +65 to +69
* Sets a custom disconnect reason for the player.
* Passing {@code null} will show the default reason.
*
* @param reason the disconnect reason to show to the player
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to detail the functionality of the method, something like: “if a valid server is not provided as the initial server, this message will be used to disconnect the player; if it is not present or null is used, the default message will be used”

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of allowing null here, maybe we just fire the event with the default message as initial reason?

@4drian3d 4drian3d added the type: feature New feature or request label Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants