mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-28 02:01:43 +01:00
Fixed Flags being sorted due to their text color
Colors are now stripped, so that all Flags are properly alphabetically sorted
This commit is contained in:
parent
7dc39946f1
commit
4209afaf20
@ -6,6 +6,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -76,7 +78,8 @@ public class SettingsTab implements Tab, ClickHandler {
|
|||||||
protected List<Flag> getFlags() {
|
protected List<Flag> getFlags() {
|
||||||
// Get a list of flags of the correct type and sort by the translated names
|
// Get a list of flags of the correct type and sort by the translated names
|
||||||
List<Flag> flags = plugin.getFlagsManager().getFlags().stream().filter(f -> f.getType().equals(type))
|
List<Flag> flags = plugin.getFlagsManager().getFlags().stream().filter(f -> f.getType().equals(type))
|
||||||
.sorted(Comparator.comparing(flag -> user.getTranslation(flag.getNameReference())))
|
// We're stripping colors to avoid weird sorting issues
|
||||||
|
.sorted(Comparator.comparing(flag -> ChatColor.stripColor(user.getTranslation(flag.getNameReference()))))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// Remove any that are not for this game mode
|
// Remove any that are not for this game mode
|
||||||
plugin.getIWM().getAddon(world).ifPresent(gm -> flags.removeIf(f -> !f.getGameModes().isEmpty() && !f.getGameModes().contains(gm)));
|
plugin.getIWM().getAddon(world).ifPresent(gm -> flags.removeIf(f -> !f.getGameModes().isEmpty() && !f.getGameModes().contains(gm)));
|
||||||
|
Loading…
Reference in New Issue
Block a user