1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-05 14:18:21 +02:00

Update WorldDataHolder.java

Set Primary group before sub group on loading else the subgroup tests default.
This commit is contained in:
ElgarL
2014-10-03 08:25:04 +01:00
parent 4fb96aa586
commit c843a329bd

View File

@@ -960,42 +960,6 @@ public class WorldDataHolder {
thisUser.sortPermissions(); thisUser.sortPermissions();
} }
// SUBGROUPS NODES
nodeData = null;
try {
nodeData = thisUserNode.get("subgroups");
} catch (Exception ex) {
throw new IllegalArgumentException("Bad format found in 'subgroups' for user: " + usersKey + " in file: " + usersFile.getPath());
}
if (nodeData == null) {
/*
* If no subgroups node is found, or it's empty do nothing.
*/
} else if (nodeData instanceof List) {
for (Object o : ((List) nodeData)) {
if (o == null) {
GroupManager.logger.warning("Invalid Subgroup data for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
} else {
Group subGrp = ph.getGroup(o.toString());
if (subGrp != null) {
thisUser.addSubGroup(subGrp);
} else {
GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
}
}
}
} else if (nodeData instanceof String) {
Group subGrp = ph.getGroup(nodeData.toString());
if (subGrp != null) {
thisUser.addSubGroup(subGrp);
} else {
GroupManager.logger.warning("Subgroup '" + nodeData.toString() + "' not found for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
}
}
// USER INFO NODE // USER INFO NODE
nodeData = null; nodeData = null;
@@ -1036,6 +1000,41 @@ public class WorldDataHolder {
} else { } else {
thisUser.setGroup(ph.getDefaultGroup()); thisUser.setGroup(ph.getDefaultGroup());
} }
// SUBGROUPS NODES
nodeData = null;
try {
nodeData = thisUserNode.get("subgroups");
} catch (Exception ex) {
throw new IllegalArgumentException("Bad format found in 'subgroups' for user: " + usersKey + " in file: " + usersFile.getPath());
}
if (nodeData == null) {
/*
* If no subgroups node is found, or it's empty do nothing.
*/
} else if (nodeData instanceof List) {
for (Object o : ((List) nodeData)) {
if (o == null) {
GroupManager.logger.warning("Invalid Subgroup data for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
} else {
Group subGrp = ph.getGroup(o.toString());
if (subGrp != null) {
thisUser.addSubGroup(subGrp);
} else {
GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
}
}
}
} else if (nodeData instanceof String) {
Group subGrp = ph.getGroup(nodeData.toString());
if (subGrp != null) {
thisUser.addSubGroup(subGrp);
} else {
GroupManager.logger.warning("Subgroup '" + nodeData.toString() + "' not found for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
}
}
} }
} }