[SOLVED] Sort Set<String>

Discussion in 'Spigot Plugin Development' started by to175, Jul 13, 2015.

  1. Hi, I need help please :)
    I want the player enters in the team with less member, I can't manage to do it :(
    Code (Text):
    Set<String> SetTeams = config.getConfigurationSection("TeamsConfig").getKeys(false);//get all teams
                int nouvelleTeamSizeINT = 10;//I don't know how to do it.......
                String nouvelleTeam = "none";//= newTeam
                for(String team: SetTeams){
                    if(config.getInt("GameDatas.Teams."+team+".TotalPlayers") < nouvelleTeamSizeINT){
                         nouvelleTeamSizeINT = config.getInt("GameDatas.Teams."+team+".TotalPlayers");
                         nouvelleTeam = team;
  2. Everytime someone joins a team are you increased the number in the config? If you are going to be referencing teams etc your better off creating a object which will hold all the data of a team such as a list of uuids etc which you can use to get the size of the team.
  3. Thanks,
    But if the server restart ! I lose everything. Hm I don't know, first I want to fix this :p

    EDIT : you were right, I didn't add the player correctly ... thanks !
    #3 to175, Jul 13, 2015
    Last edited: Jul 13, 2015
  4. Then when the server restart on disable get the objects are loop through them and save the data.