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