summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-10-01 13:54:28 +0100
committerElgarL <ElgarL@palmergames.com>2011-10-01 13:54:28 +0100
commit30af6f36ceaa12d7bbcdd8294074b3ce764c6695 (patch)
treec5db514766e8149aff69d8172948c60a992d2b50 /EssentialsGroupManager/src/org
parentf712b56671cd3197e645d4cf59838d26b61f11c7 (diff)
downloadEssentials-30af6f36ceaa12d7bbcdd8294074b3ce764c6695.tar
Essentials-30af6f36ceaa12d7bbcdd8294074b3ce764c6695.tar.gz
Essentials-30af6f36ceaa12d7bbcdd8294074b3ce764c6695.tar.lz
Essentials-30af6f36ceaa12d7bbcdd8294074b3ce764c6695.tar.xz
Essentials-30af6f36ceaa12d7bbcdd8294074b3ce764c6695.zip
Attempt to stop GM wiping groups/users yml's on a bad shut down.
Diffstat (limited to 'EssentialsGroupManager/src/org')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index 77d933fa0..4a9f806d8 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -767,13 +767,15 @@ public class WorldDataHolder {
aGroupMap.put("permissions", group.getPermissionList());
}
- DumperOptions opt = new DumperOptions();
- opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- final Yaml yaml = new Yaml(opt);
- try {
- yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- } catch (FileNotFoundException ex) {
+ if (!root.isEmpty()) {
+ DumperOptions opt = new DumperOptions();
+ opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ final Yaml yaml = new Yaml(opt);
+ try {
+ yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ } catch (FileNotFoundException ex) {
+ }
}
/*FileWriter tx = null;
@@ -829,13 +831,16 @@ public class WorldDataHolder {
aUserMap.put("subgroups", user.subGroupListStringCopy());
//END SUBGROUPS NODE - BETA
}
- DumperOptions opt = new DumperOptions();
- opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- final Yaml yaml = new Yaml(opt);
- try {
- yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- } catch (FileNotFoundException ex) {
+
+ if (!root.isEmpty()) {
+ DumperOptions opt = new DumperOptions();
+ opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ final Yaml yaml = new Yaml(opt);
+ try {
+ yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ } catch (FileNotFoundException ex) {
+ }
}
/*FileWriter tx = null;
try {