Skip to content

Commit

Permalink
Fix #42
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-MX committed Dec 21, 2024
1 parent d2f6fd9 commit c1f4037
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tasks {
hangar("ViaBackwards", "5.0.1")

// For testing groups in config.yml
// url("https://download.luckperms.net/1556/bukkit/loader/LuckPerms-Bukkit-5.4.141.jar")
url("https://download.luckperms.net/1567/bukkit/loader/LuckPerms-Bukkit-5.4.150.jar")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

import java.util.Comparator;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -71,6 +72,7 @@ public void registerDefaultRefreshListener(@NotNull NameTagEntity tag, long refr
.entrySet()
.stream()
.filter((e) -> player.hasPermission(e.getKey()))
.sorted(GroupPriorityComparator.get())
.toList();

long recentRefreshEvery = plugin.getConfig().getLong("defaults.refresh-every", 50);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.mattmx.nametags.config;

import org.bukkit.configuration.ConfigurationSection;
import org.jetbrains.annotations.NotNull;

import java.util.Comparator;
import java.util.Map;

public class GroupPriorityComparator {
private static final @NotNull Comparator<Map.Entry<String, ConfigurationSection>> INSTANCE =
Comparator.comparingInt((s) -> s.getValue().getInt("priority"));

public static @NotNull Comparator<Map.Entry<String, ConfigurationSection>> get() {
return INSTANCE;
}
}

0 comments on commit c1f4037

Please sign in to comment.