Using default group for users with unknown group.

Ignore double users.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1460 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-14 10:42:18 +00:00
parent 78ce69528f
commit 58daa86b79

View File

@ -335,7 +335,7 @@ public class WorldDataHolder {
Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey); Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey);
Group thisGrp = ph.createGroup(groupKey); Group thisGrp = ph.createGroup(groupKey);
if (thisGrp == null) { if (thisGrp == null) {
throw new IllegalArgumentException("I think this user was declared more than once: " + groupKey); throw new IllegalArgumentException("I think this group was declared more than once: " + groupKey);
} }
if (thisGroupNode.get("default") == null) { if (thisGroupNode.get("default") == null) {
thisGroupNode.put("default", false); thisGroupNode.put("default", false);
@ -408,7 +408,8 @@ public class WorldDataHolder {
Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey); Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey);
User thisUser = ph.createUser(usersKey); User thisUser = ph.createUser(usersKey);
if (thisUser == null) { if (thisUser == null) {
throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey); GroupManager.logger.warning("I think this user was declared more than once: " + usersKey);
continue;
} }
if (thisUserNode.get("permissions") == null) { if (thisUserNode.get("permissions") == null) {
thisUserNode.put("permissions", new ArrayList<String>()); thisUserNode.put("permissions", new ArrayList<String>());
@ -434,7 +435,8 @@ public class WorldDataHolder {
if (thisUserNode.get("group") != null) { if (thisUserNode.get("group") != null) {
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString()); Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());
if (hisGroup == null) { if (hisGroup == null) {
throw new IllegalArgumentException("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName()); GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName());
thisUser.setGroup(ph.defaultGroup);
} }
thisUser.setGroup(hisGroup); thisUser.setGroup(hisGroup);
} else { } else {