This is my config I want to get the player's name or in this case staff one staff2 ... and at the end of the each players name and the rank I want it to say Is (online or offline ) is this possible? staff: - staff1 is a Mod - staff2 is a helper - staff3 - staff4 is a dude I got this code for getting the config text. Code (Text): if(cmd.getName().equalsIgnoreCase("staff")){ List<String> staff = this.getConfig().getStringList("staff"); for (String s : staff) { player.sendMessage(s); } [/code\
Contain the name and rank in one string, then use create an offline player object with Bukkit#getOfflinePlayer(String) (String is their name) and use OfflinePlayer#isOnline()
Use a seperator character between name and rank, like : for example, split the string value at that character and go from there
Code (Text): Player player = event.getPlayer(); String name = player.getName(); player.sendMessage(name);
Code (Text): p.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("NAME OF IT HOW IT SHOULD BE IN THE CONFIG").replace("%player%", name));
He's trying to get the value of a name and rank from a list of staff ranks. I've told him what do already
Code (Java): for (String s : Bukkit.getPlugin(Main.class).getConfig().getStringList("staff")) if (s.contains(separatorChar)) staff.put(Bukkit.getOfflinePlayer(s.split(separatorChar)[0]).getUniqueId(), //Staff: HashMap<UUID, Rank(Enum)> staff = ...; Rank.valueOf(Bukkit.getOfflinePlayer(s.split(separatorChar)[0]).getUniqueId())); Loop through and get the rank name and if it's online and send your messages. Hope that's what you wanted.
This is what i got. Code (Text): List<String> staff = this.getConfig().getStringList("staff"); for (String s : staff) { String arr[] = s.split(" "); player.sendMessage(s+ arr); }