Skip to content

Commit

Permalink
Fix stafflist usernames show in Discord commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
frafol committed Jan 23, 2025
1 parent 900039b commit 1abe0b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
if (BungeeConfig.SORTING_LIST_ENABLE.get(Boolean.class)) {
List<UUID> sortedList = new ArrayList<>();
for (String groups : BungeeConfig.SORTING_LIST.getStringList()) {
for (User user : api.getUserManager().getLoadedUsers()) {
for (UUID uuid : list) {
User user = api.getUserManager().getUser(uuid);
if (user == null) continue;
Group group = api.getGroupManager().getGroup(groups);
if (user.getInheritedGroups(QueryOptions.builder(QueryMode.CONTEXTUAL).build()).contains(group)) {
sortedList.add(user.getUniqueId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,12 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
List<UUID> list = Lists.newArrayList();
if (!PLUGIN.getServer().getOnlinePlayers().isEmpty()) {
for (Player players : PLUGIN.getServer().getOnlinePlayers()) {

if (!players.hasPermission(SpigotConfig.STAFFLIST_SHOW_PERMISSION.get(String.class))) {
continue;
}

if (SpigotConfig.STAFFLIST_BYPASS.get(Boolean.class) && players.hasPermission(SpigotConfig.STAFFLIST_BYPASS_PERMISSION.get(String.class))) {
continue;
}

list.add(players.getUniqueId());
}
}
Expand All @@ -240,7 +237,9 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
if (SpigotConfig.SORTING_LIST_ENABLE.get(Boolean.class)) {
List<UUID> sortedList = new ArrayList<>();
for (String groups : SpigotConfig.SORTING_LIST.getStringList()) {
for (User user : api.getUserManager().getLoadedUsers()) {
for (UUID uuid : list) {
User user = api.getUserManager().getUser(uuid);
if (user == null) continue;
Group group = api.getGroupManager().getGroup(groups);
if (user.getInheritedGroups(QueryOptions.builder(QueryMode.CONTEXTUAL).build()).contains(group)) {
sortedList.add(user.getUniqueId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,14 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
if (VelocityConfig.SORTING_LIST_ENABLE.get(Boolean.class)) {
List<UUID> sortedList = new ArrayList<>();
for (String groups : VelocityConfig.SORTING_LIST.getStringList()) {
for (User user : api.getUserManager().getLoadedUsers()) {
for (UUID uuid : list) {
User user = api.getUserManager().getUser(uuid);
if (user == null) continue;
Group group = api.getGroupManager().getGroup(groups);
if (user.getInheritedGroups(QueryOptions.builder(QueryMode.CONTEXTUAL).build()).contains(group)) {
sortedList.add(user.getUniqueId());
if (!sortedList.contains(user.getUniqueId()) && list.contains(user.getUniqueId())) {
sortedList.add(user.getUniqueId());
}
}
}
}
Expand Down

0 comments on commit 1abe0b6

Please sign in to comment.