summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-10-31 02:06:25 +0000
committerElgarL <ElgarL@palmergames.com>2011-10-31 02:06:25 +0000
commitb1c6173995721831c88570dd32edc77c369dca7a (patch)
treeeb167792f21c653ec381d38509f0afd426ca50bb /EssentialsGroupManager/src/org/anjocaido
parent4ac03ef15a7c729a683bfd65b419d0d6ca65756c (diff)
downloadEssentials-b1c6173995721831c88570dd32edc77c369dca7a.tar
Essentials-b1c6173995721831c88570dd32edc77c369dca7a.tar.gz
Essentials-b1c6173995721831c88570dd32edc77c369dca7a.tar.lz
Essentials-b1c6173995721831c88570dd32edc77c369dca7a.tar.xz
Essentials-b1c6173995721831c88570dd32edc77c369dca7a.zip
Fixed GM loading world data files twice at startup.
Improved error reporting for invalid groups.yml
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java57
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java2
2 files changed, 33 insertions, 26 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index 4a9f806d8..c8dc8cbd1 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -483,7 +483,7 @@ public class WorldDataHolder {
//PROCESS GROUPS FILE
Map<String, List<String>> inheritance = new HashMap<String, List<String>>();
- try {
+ //try {
Map<String, Object> allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups");
for (String groupKey : allGroupsNode.keySet()) {
Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey);
@@ -513,36 +513,43 @@ public class WorldDataHolder {
} else if (thisGroupNode.get("permissions") instanceof String) {
thisGrp.addPermission((String) thisGroupNode.get("permissions"));
} else {
- throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>): " + thisGroupNode.get("permissions").getClass().getName());
+ throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName());
}
//INFO NODE
- Map<String, Object> infoNode = (Map<String, Object>) thisGroupNode.get("info");
- if (infoNode != null) {
- thisGrp.setVariables(infoNode);
- }
+ if (thisGroupNode.get("info") instanceof Map) {
+ Map<String, Object> infoNode = (Map<String, Object>) thisGroupNode.get("info");
+ if (infoNode != null) {
+ thisGrp.setVariables(infoNode);
+ }
+ } else
+ throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName());
+
//END INFO NODE
- Object inheritNode = thisGroupNode.get("inheritance");
- if (inheritNode == null) {
- thisGroupNode.put("inheritance", new ArrayList<String>());
- } else if (inheritNode instanceof List) {
- List<String> groupsInh = (List<String>) inheritNode;
- for (String grp : groupsInh) {
- if (inheritance.get(groupKey) == null) {
- List<String> thisInherits = new ArrayList<String>();
- inheritance.put(groupKey, thisInherits);
- }
- inheritance.get(groupKey).add(grp);
-
- }
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details.");
- }
+ if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) {
+ Object inheritNode = thisGroupNode.get("inheritance");
+ if (inheritNode == null) {
+ thisGroupNode.put("inheritance", new ArrayList<String>());
+ } else if (inheritNode instanceof List) {
+ List<String> groupsInh = (List<String>) inheritNode;
+ for (String grp : groupsInh) {
+ if (inheritance.get(groupKey) == null) {
+ List<String> thisInherits = new ArrayList<String>();
+ inheritance.put(groupKey, thisInherits);
+ }
+ inheritance.get(groupKey).add(grp);
+
+ }
+ }
+ }else
+ throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName());
+ }
+ //} catch (Exception ex) {
+ // ex.printStackTrace();
+ // throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details.");
+ //}
if (ph.defaultGroup == null) {
throw new IllegalArgumentException("There was no Default Group declared.");
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index 7cbe4f65c..7c40e19f5 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -100,7 +100,7 @@ public class WorldsHolder {
* or mirrored worlds that don't need data.
*/
if (!worldsData.containsKey(folder.getName().toLowerCase())
- || !mirrors.containsKey(folder.getName().toLowerCase())) {
+ && !mirrors.containsKey(folder.getName().toLowerCase())) {
loadWorld(folder.getName());
}