summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido/groupmanager
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-09-03 16:13:43 +0100
committerElgarL <ElgarL@palmergames.com>2011-09-03 16:13:43 +0100
commite3756623a1531241b40084c0aa9a8e4b4e8cda31 (patch)
tree14fa17cb72c2868b180b215ccb2b7742626cc477 /EssentialsGroupManager/src/org/anjocaido/groupmanager
parent8f28073b29a99c46ed3782784cc928c54addcb26 (diff)
downloadEssentials-e3756623a1531241b40084c0aa9a8e4b4e8cda31.tar
Essentials-e3756623a1531241b40084c0aa9a8e4b4e8cda31.tar.gz
Essentials-e3756623a1531241b40084c0aa9a8e4b4e8cda31.tar.lz
Essentials-e3756623a1531241b40084c0aa9a8e4b4e8cda31.tar.xz
Essentials-e3756623a1531241b40084c0aa9a8e4b4e8cda31.zip
- Fix for Users.yml containing only 'users:' causing a crash.
- GroupManager will now generate a fresh Users and Groups yml if either file is empty.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java5
-rw-r--r--[-rwxr-xr-x]EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java4
2 files changed, 7 insertions, 2 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index ae68e03cc..77d933fa0 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -578,6 +578,11 @@ public class WorldDataHolder {
// PROCESS USERS FILE
Map<String, Object> allUsersNode = (Map<String, Object>) usersRootDataNode.get("users");
+
+ // Stop loading if the file is empty
+ if (allUsersNode == null)
+ return ph;
+
for (String usersKey : allUsersNode.keySet()) {
Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey);
User thisUser = ph.createUser(usersKey);
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index b4d50b431..a2c34be16 100755..100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -265,7 +265,7 @@ public class WorldsHolder {
File groupsFile = new File(defaultWorldFolder, "groups.yml");
File usersFile = new File(defaultWorldFolder, "users.yml");
File oldDataFile = new File(plugin.getDataFolder(), "data.yml");
- if (!groupsFile.exists()) {
+ if (!groupsFile.exists() || groupsFile.length() == 0) {
if (oldDataFile.exists()) {
try {
Tasks.copy(oldDataFile, groupsFile);
@@ -281,7 +281,7 @@ public class WorldsHolder {
}
}
}
- if (!usersFile.exists()) {
+ if (!usersFile.exists() || usersFile.length() == 0) {
if (oldDataFile.exists()) {
try {
Tasks.copy(oldDataFile, usersFile);