diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index a877078d8..0c9b13a47 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -199,4 +199,5 @@ v 2.0: - Include the GM version when logging errors. - Fix Synchronization on adding subgroups (thanks snowleo). - Remove info node support from GlobalGroups. It should not have them as GlobalGroups are only permission collections. - - Change order of data in Users.yml to [name, Group, SubGroup, Permissions, Info nodes]. \ No newline at end of file + - Change order of data in Users.yml to [name, Group, SubGroup, Permissions, Info nodes]. + - Add alphabetically sorted user lists. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index 9790efa2a..a4b346154 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -15,8 +15,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.TreeSet; import java.util.logging.Level; import java.util.logging.Logger; import org.anjocaido.groupmanager.GroupManager; @@ -1018,17 +1020,19 @@ public class WorldDataHolder { public static void writeUsers(WorldDataHolder ph, File usersFile) { Map root = new HashMap(); - - Map usersMap = new HashMap(); + LinkedHashMap usersMap = new LinkedHashMap(); + root.put("users", usersMap); synchronized (ph.getUsers()) { - for (String userKey : ph.getUsers().keySet()) { + + // A sorted list of users. + for (String userKey : new TreeSet(ph.getUsers().keySet())) { User user = ph.getUsers().get(userKey); if ((user.getGroup() == null || user.getGroup().equals(ph.getDefaultGroup())) && user.getPermissionList().isEmpty() && user.getVariables().isEmpty() && user.isSubGroupsEmpty()) { continue; } - Map aUserMap = new HashMap(); + LinkedHashMap aUserMap = new LinkedHashMap(); usersMap.put(user.getName(), aUserMap); // GROUP NODE diff --git a/EssentialsGroupManager/src/users.yml b/EssentialsGroupManager/src/users.yml index 72a7b652f..19496ad84 100644 --- a/EssentialsGroupManager/src/users.yml +++ b/EssentialsGroupManager/src/users.yml @@ -1,15 +1,15 @@ # "For a more advanced configuration example utilizing the advanced features of GroupManager, see http://pastebin.com/a8ZA0j5G" users: snowleo: - subgroups: [] - permissions: [] group: Builder + subgroups: [] + permissions: [] KHobbits: + group: Moderator subgroups: [] permissions: [] - group: Moderator ElgarL: + group: Moderator subgroups: [] permissions: [] - group: Moderator