Is there a simple way to grab online pex users in a list? I have tried this: Code: PermissionUser[] admins = pex.getUsers("admins"); .... p.sendMessage("§2" + admins); Including about every variation I can imagine on the last one: Code: admins.clone() admins.toString() Right now I'm just using: Code: Integer.toString(admins.length) So that the output is just a number instead of a bunch of stuff like this: Code: [Lru.tehkode.permissions.PermissionUser;@682bb56a Also, for the love of god, don't tell me to run off and get Vault. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Code: private ArrayList<String> admins = new ArrayList(); //For the method of putting them into a list for(Player players:Bukkit.getOnlinePlayers()) { if(PermissionsEx.getUser(players).inGroup("ServerOwner")) { admins.add(players.getName()); } } String g = admins.toString(); player.sendMessage("Admins Online: " + g); admins.clear();
I got the names working (thanks for that), and I did Code: public String nobrackets(String string) { string = string.replaceAll("[", ""); return string = string.replaceAll("]", ""); } To get rid of the brackets, now my only issue is that I can't seem to get the people within the groups visible to others. Gotta say I've gotten pretty far with this though
Because it isn't public in the first place. Because I want to learn with Pex. Because I asked, for information's sake
AmberK The way that you first post is correct you can simply iterate through admins as for(PermissionUser p: admins){ //p is an individual user } Might not work but it saves you from looping through all online players, If I am completely wrong its probably cause I read the question wrong.
Also if you want to get all players and be able to do this admin[0] admin[1] etc... use PHP: string = string.replaceAll(" ", "");String[] admin = line.split(","); //To get themadmin[0] admin[1] admin[2] admin[3] etc...