Add custom disconnect reason to PlayerChooseInitialServerEvent#1583
Open
radek203 wants to merge 2 commits intoPaperMC:dev/3.0.0from
Open
Add custom disconnect reason to PlayerChooseInitialServerEvent#1583radek203 wants to merge 2 commits intoPaperMC:dev/3.0.0from
radek203 wants to merge 2 commits intoPaperMC:dev/3.0.0from
Conversation
pingguomc
approved these changes
Jun 5, 2025
4drian3d
reviewed
Sep 22, 2025
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 | ||
| */ |
Contributor
There was a problem hiding this comment.
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”
Contributor
There was a problem hiding this comment.
Instead of allowing null here, maybe we just fire the event with the default message as initial reason?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
setReason(Component reason)method toPlayerChooseInitialServerEvent, 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.