Getting groups sorted by height from Vault(LuckPerms)

Discussion in 'Plugin Development' started by KAM202, Jul 14, 2019.

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

    KAM202

    Hey. I am trying to make a list of players in groups sorted by the height of the group. Currently writing all the groups from the oldest to the youngest and I want it to sort the height.
    I'm using Vault and permission plugin: LuckPerms.

    Current class:
    Code:
    for(String s : this.plugin.permission.getGroups()) {
                    for(Player player : Bukkit.getOnlinePlayers()) {
                        if(this.plugin.permission.getPrimaryGroup(player) == s) {
                                players.add(player.getDisplayName());
                        }
                    }
                    if(players.size() > 0) {
                        String listString = String.join(", ", players);
                        p.sendMessage(s + ": " + listString);
                    }
                    players.clear();
                }
    How can I do this?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @KAM202 Compare strings with .equals and .equalsIgnoreCase, not with ==
     
Thread Status:
Not open for further replies.

Share This Page