From ef0581799183c42c0135d4eb8daec0b195604295 Mon Sep 17 00:00:00 2001 From: Kam Date: Sun, 23 Feb 2025 22:43:55 -0500 Subject: [PATCH] Sort Profile Info --- .../java/kamkeel/npcs/controllers/ProfileController.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/kamkeel/npcs/controllers/ProfileController.java b/src/main/java/kamkeel/npcs/controllers/ProfileController.java index 56253b86b..0a4078450 100644 --- a/src/main/java/kamkeel/npcs/controllers/ProfileController.java +++ b/src/main/java/kamkeel/npcs/controllers/ProfileController.java @@ -601,8 +601,11 @@ public class ProfileController implements IProfileHandler { Profile profile = getProfile(player); if (profile == null) return infoList; + + List dataList = new ArrayList<>(profileTypes.values()); + dataList.sort(Comparator.comparingInt(IProfileData::getSwitchPriority)); if (slotId == profile.getCurrentSlotId()) { - for (IProfileData pd : profileTypes.values()) { + for (IProfileData pd : dataList) { NBTTagCompound currentNBT = pd.getCurrentNBT(player); List subInfo = pd.getInfo(player, currentNBT); infoList.addAll(subInfo); @@ -611,7 +614,7 @@ public class ProfileController implements IProfileHandler { if (!profile.getSlots().containsKey(slotId)) return infoList; ISlot slot = profile.getSlots().get(slotId); - for (IProfileData pd : profileTypes.values()) { + for (IProfileData pd : dataList) { if (slot.getComponents().containsKey(pd.getTagName())) { NBTTagCompound sub = slot.getComponentData(pd.getTagName()); List subInfo = pd.getInfo(player, sub);