Skip to content

fix(team): fix capacity check and Splitter distribution - #101

Merged
theEvilReaper merged 2 commits into
mainfrom
fix/teamBugs
Oct 9, 2026
Merged

theEvilReaper merged 2 commits into
mainfrom
fix/teamBugs

Conversation

@theEvilReaper

@theEvilReaper theEvilReaper commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

This PR fixes two bugs in the team module. Team#canJoin used to check size != capacity, so a team above its capacity still let players join, for example after lowering the capacity with setCapacity. It now uses <, so a team at or above its capacity rejects new players. Splitter#compute returned null when an even brute-force distribution was impossible, which caused an NPE in DefaultTeamDistributor, and it now throws an IllegalArgumentException with a clear message instead. The low-variance (greedy) mode is unchanged and still exceeds the team size when there are too many players, as the existing tests expect.

Types of changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of
them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before
merging your code.

  • I have read the CONTRIBUTING.md
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Test results

 81 files   81 suites   22s ⏱️
114 tests 114 ✅ 0 💤 0 ❌
348 runs  348 ✅ 0 💤 0 ❌

Results for commit 113223c.

@theEvilReaper
theEvilReaper merged commit 9d8c1ea into main Oct 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant