Solved Using config.getKeys not working correctly

Discussion in 'Plugin Development' started by sgavster, Feb 24, 2016.

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


    Hello! I'm trying to get a list of players from my config; I'm using
    Set<String> names = Main.getMain().getConfig().getConfigurationSection("playersnameingame").getKeys(false);
    and then using this to get the player
            for(String z : names) {
                Player p = Bukkit.getPlayer(z);
                return p;
    It only ever returns one player even when there should be two, this is causing a huge bug and I just can't squash it.. Any help would be great.
  2. Offline


    Don't Abuse Static. Instead pass the instance of main to all the classes that need it.

    No, there shouldn't be two. Once you return, JVM stops reading the method.

    If you want to return multiple players, you would have to return an array or collection.
Thread Status:
Not open for further replies.

Share This Page