1.12.2 How to get players from a group in LuckPerms API?

Discussion in 'Spigot Plugin Development' started by serega100, Feb 13, 2020.

  1. I can't understand how to do it.
     
  2. the only way i know how is to iterate over all players and use #hasPermission("group.groupName") to know that they are apart of this group
    hush. luckperms api is missing some useful functionality. theres no way to do what he wnats through the luckperms api.

    /e well technically there is, but it does the exact same thing as #hasPermission and takes more work to get to it
     
  3. Theres surely a way in there,these players must be stored somewhere=there is a set and get from a list

    But as stated above we arent seeing any tries yet
     
  4. use that function:
    Code (Java):
    public static boolean isPlayerInGroup(Player player, String group) {
            return player.hasPermission("group." + group);
        }
     
  5. Strahan

    Benefactor

    That seems like a pointless function; I mean, if you already have a Player object (which is required as that is an argument) why not just call .hasPermission against it? Also one must bear in mind that will be true if the player is OP or has a wildcard (*) permission.
     
  6. Wow, man. If luckperms groups can more than return name, I don't ask the question.
    I want to put to a GUI all offline&online admins, moders, etc. So I need to get all players from the groups.