Repository navigation
Conversation
Member
|
The off-by-one is real, but the cause is that Changing to The connection shouldn't count against itself on the second check, which matches vanilla, where only fully joined players are counted. Something like this in final boolean counted = this.usersCountedAgainstLimit.contains(conn);
final int count = this.usersCountedAgainstLimit.size() - (counted ? 1 : 0);
if (count >= limit) {
return false;
}
this.usersCountedAgainstLimit.add(conn);
return true; |
R00tB33rMan
added a commit
to CraftCanvasMC/Canvas
that referenced
this pull request
Nov 19, 2026
canPlayerLogin runs at login and again when configuration finishes for the same connection, so the second check counted the connection against itself. Checking for more than the limit gave the last slot back but let a login exceed it, only to kick the player when configuration finished; the second check now leaves the connection out of the count, as vanilla only counts fully joined players. Port of PaperMC/Folia#544 (comment)
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.
Folia rewrites login and uses the incorrect comparison for the login count, causing the limit set to be offset by -1. Small fix but whatever