Solved Config? Countdown?

Discussion in 'Plugin Development' started by ProMCKingz, Dec 13, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ProMCKingz

    @timtower @mythbusterma
    How would I do that?
    To get all the players in the map, since I want to seperate them into teams
     
  2. Offline

    mythbusterma

  3. Online

    timtower Administrator Administrator Moderator

  4. Offline

    xTrollxDudex

  5. Offline

    Jayke_

    @Dragonphase Even though this is solved, the point was that it was different in his code. He had "countdown" in the code, and "Countdown" in the config.
     
  6. Offline

    Dragonphase

    @Jayke_

    Then a more suitable solution would've been to change it in his code.
     
  7. Offline

    Jayke_

    @Dragonphase Either would have worked - I was just showing that they did not match, and that it was an issue - where you said it was not.
     
  8. Offline

    ProMCKingz

    @timtower
    This gives me errors?
    Code:
    int i = 0;
            for(Player player : Bukkit.getPlayer(plugin.InGame.keySet())){
                if(i >= Team.getAllTeams().size())
                i = 0;
                Team.getTeam(Team.getAllTeams().get(i++).getName()).add(player);;
        }
    @mythbusterma
     
  9. Online

    timtower Administrator Administrator Moderator

    @ProMCKingz You are trying to get a player from a keySet, that won't work
     
  10. Offline

    ProMCKingz

  11. Online

    timtower Administrator Administrator Moderator

    @ProMCKingz You get the set, loop through that, get a player instance from that key
     
  12. Offline

    ProMCKingz

    @timtower
    Would it be easier to use arrays?

    @timtower
    Current class code:
    Code:
    public class LobbyCount extends BukkitRunnable{
       
        Main plugin;
        public LobbyCount(Main pl){
            plugin = pl;
        }
       
        int min = JavaPlugin.getPlugin(Main.class).getConfig().getInt("Min-Players");
    
        public static int tts;
       
        public void run(){
                    if(tts == 0){
                        Game.start();
                    }
                   
                    if (tts % 10 ==0 || tts<10){
                        ChatUtils.broadcast(String.valueOf(tts) + " seconds until the game starts!");
            }
                    if (tts >= 1){
                        tts-= 1;
        }else if(tts <= 1){
            plugin.stopCountdown();
            int i = 0;
            for(Player player : Bukkit.getPlayer(plugin.InGame.keySet())){
                if(i >= Team.getAllTeams().size())
                i = 0;
                Team.getTeam(Team.getAllTeams().get(i++).getName()).add(player);;
        }
    }
    }
    }
    EDIT by TImtower: merged posts
     
  13. Online

    timtower Administrator Administrator Moderator

    @ProMCKingz That is your call, not mine. Don't know why you would want to use arrays though
     
  14. Offline

    ProMCKingz

  15. Online

    timtower Administrator Administrator Moderator

    @ProMCKingz And who says that you need arrays for that?
     
  16. Offline

    ProMCKingz

    Last edited by a moderator: Dec 15, 2014
  17. Online

    timtower Administrator Administrator Moderator

    @ProMCKingz Loop through the strings / whatever type you have in your keyset, then get the player from that object inside the loop.
    Also: please use the edit button instead of double posting
     
Thread Status:
Not open for further replies.

Share This Page