mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-10-07 03:58:45 +02:00
Catch errors caused by bad indentation in yml's.
This commit is contained in:
parent
1ef8ab70d1
commit
9dbeb1407c
@ -156,3 +156,4 @@ v 1.9:
|
||||
- Auto rename all case sensitive world folders to lower case (if possible).
|
||||
- Update GlobalGroups.yml for new/changed Towny permission nodes.
|
||||
- Stop attempting to push empty permissions when players edit the yml's incorrectly.
|
||||
- Catch errors caused by bad indentation in yml's.
|
@ -116,6 +116,7 @@ public class GlobalGroups {
|
||||
|
||||
// Load each groups permissions list.
|
||||
if (allGroups != null) {
|
||||
try {
|
||||
for (String groupName : allGroups.keySet()) {
|
||||
Group newGroup = new Group(groupName.toLowerCase());
|
||||
Object element;
|
||||
@ -153,6 +154,9 @@ public class GlobalGroups {
|
||||
// Push a new group
|
||||
addGroup(newGroup);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Invalid node type, or bad indentation in GlobalGroups! ");
|
||||
}
|
||||
}
|
||||
|
||||
removeGroupsChangedFlag();
|
||||
|
@ -460,6 +460,7 @@ public class WorldDataHolder {
|
||||
Map<String, List<String>> inheritance = new HashMap<String, List<String>>();
|
||||
try {
|
||||
Map<String, Object> allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups");
|
||||
try {
|
||||
for (String groupKey : allGroupsNode.keySet()) {
|
||||
Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey);
|
||||
Group thisGrp = ph.createGroup(groupKey);
|
||||
@ -547,6 +548,9 @@ public class WorldDataHolder {
|
||||
throw new IllegalArgumentException("Invalid formatting found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Invalid node type, or bad indentation in file: " + groupsFile.getPath());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new IllegalArgumentException("Your " + groupsFile.getPath() + " file is invalid. See console for details.");
|
||||
@ -609,6 +613,7 @@ public class WorldDataHolder {
|
||||
|
||||
// Load users if the file is NOT empty
|
||||
if (allUsersNode != null)
|
||||
try {
|
||||
for (String usersKey : allUsersNode.keySet()) {
|
||||
Map<String, Object> thisUserNode = null;
|
||||
try {
|
||||
@ -695,6 +700,9 @@ public class WorldDataHolder {
|
||||
thisUser.setGroup(ph.getDefaultGroup());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Invalid node type, or bad indentation in file: " + usersFile.getPath());
|
||||
}
|
||||
|
||||
ph.removeUsersChangedFlag();
|
||||
// Update the LastModified time.
|
||||
|
Loading…
Reference in New Issue
Block a user