Splitting players

Discussion in 'Spigot Plugin Development' started by coolnickname, May 4, 2015.

  1. Hello, i make a minegame plugin and need to spil the player in groups to divide them into teams. but the problem is I need the teams not divided ecually, it need to be something that 1 of 3 players will be in team 1 and the other 2 in team 2. Can someone help me with this?

    And do you support offline mode servers? Because I once got my threat locked from bukkitDev because of that.

    btw: sorry for my spelling and grammar mistakes, i'm dutch.
     
  2. Yeah spigot supports offline servers.

    You way want to try and use a team constructor.
     
  3. @BurnerDiamond,
    How do you mean?
     
  4. I'm making a tutorial right now. Wait for it ;)
     
    • Like Like x 1
  5. @@BurnerDiamond

    I sure will, but is i a tutorial only for team constructors or also for teams and scoreboards?
     
  6. @BurnerDiamond, That's the excact tutorial I used to get where I am now, I just need to divide the players between the teams
     
  7. Don't quote me on this but do something like this:

    if(team2.size() > team1.size()) {
    team2.add(player);
    else {
    team1.add(player);

    This is a really really rough draft example but something of the sort should work.
     
    #8 Bladian, May 4, 2015
    Last edited: May 4, 2015
    • Like Like x 1
  8. That would divide them ecually, I need it to be that only 1 of 3 comes in team 1 and the other 2 in team 2

    EDIT: oops, just realice I quoted it in this message:p
     
  9. Also is it just me or should it be vice versa for equal teams. Because how I read it if team 1 has 1 player and team 2 has 0 it will keep adding to team 1.

    What you could do is get the whole list size and get a third of it. The add that many players to the team and the rest to the other team.
     
  10. Also is it just me or should it be vice versa for equal teams. Because how I read it if team 1 has 1 player and team 2 has 0 it will keep adding to team 1.

    What you could do is get the whole list size and get a third of it. The add that many players to the team and the rest to the other team through A for loop.
     
  11. You are indeed correct, one second please.
     
  12. I'm not very good at math in java, could you give me a small example of how it would look like?