OMGPIDocs

OMGPI

Source

JavaDocs

SpigotMC

ClijmartTeamAsserter

ClijmartTeamAsserter is default GamePreparer in OMGPI. It uses Clijmart's team sorting algorithm, which is very good, big thanks to Mart.

First it creates a variable "t". This variable is amount of players (or max players set in mapfig, if there is a limit exceeded) and divides it by amount of custom teams (non-spec and non-default). The result is ceiled (4.3 -> 5).

Then teams are sorted: First are teams with players less than "t", next every other team, next default team (random team). Then smaller teams players are set to those teams, then bigger ones get set up until "t", but those that are left are put into least-players teams. Then all default team players are put in least-players teams.

Image below show how it is done in graphical way (yellow is default):