Hey, Currently I'm trying to finish the Sky-Block Wars plugin and have got most of it done. What i am trying to do now is the team system. I'm trying to make it even and fair but cant get my head around the best way to do it. Can someone maybe help me out. Code is up on github. I know how to do one if i hard coded max players per team but i have it so they can customize it. Game class is where most of the stuff is. I am trying to split them between 4 teams. Thanks for any help.
Sessional Well i need to split the players between 4 teams while allowing them to choose a team and still have the teams even so its not an unfair battle. So i cant have 6 people choose team red and 1 player get put in blue.
Burnett1 Only add them to a new team if the size isn't bigger then the rest? Should just be an if statement. if team1.length < team2.length && team1.length < team3.length && team1.length < team4.length then add them to team 1 else tell the player they can't join this team at the moment. You could use an ArrayList or a LinkedList to accomplish dynamic sized teams.
Sessional I have done this but then comes the fact people can choose a team. Lets say the max per team is 4, 8 people join a game, 4 of those people choose to go in red and the other 4 get split by the game into yellow, green and blue. Doing that system would make two of them have 1 player and the other one have 2 players. Teams are then uneven.
Only put them in a team/allow them to join the team if the rest of the teams are the same size - these 4 people can't all join the same team unless the other teams happen to have players joining them. Say player 1 joins team 1. Player 2 can not join team 1 until someone joins team 2, 3 AND 4 to keep them even, so he joins 2 Player 3 can only join player team 3 and 4 then Player 4 can only join whichever Player 3 can't join Correct?