I was trying to get a list from the config but i realy dont know how to split them up and then check if the player is online or not? Anyone that can help me out? Code: if (this.Rpgf.getConfig().getConfigurationSection(player.getName()) == null) { player.sendMessage(ChatColor.AQUA + "Je hebt niemand in je vrienden lijst!"); return true; } StringBuilder sb = new StringBuilder(); for(String Friends : this.Rpgf.getConfig().getConfigurationSection(player.getName() + ".Friends").getKeys(false)){ sb.append(Friends + ", "); } sender.sendMessage(ChatColor.AQUA + "------------=Friend=------------"); sender.sendMessage(ChatColor.RED + "Rood " + ChatColor.AQUA + "betekend offline," + ChatColor.GREEN + "groen" + ChatColor.AQUA + "betekend online"); if(!(sb.toString() == null)) { sender.sendMessage(ChatColor.GREEN + sb.toString() + " is online!"); }
To check if player is online use Code:java if(Bukkit.getPlayer(NICK) == null){//Player is offline!}else{//Player is online!}
psuedoe code, wrote in quick reply Code: List<String> players_from_config = new ArrayList<String>(); players_from_config = getConfig().getStringList("Players"); for(String blah : players_from_config){ if(this.getServer().getPlayer(blah) != null){ //do something with the player here } }