From 022f7ab1d45492ce5cebba077cb4ffad8c637e9b Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 17 Nov 2011 05:46:01 +0000 Subject: [PATCH 1/2] Fixed GM holding files open and causing the time stamp to be incorrect. This caused GM to require a '/mansave force' when it shouldn't be needed. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../groupmanager/dataholder/WorldDataHolder.java | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index d71bc135a..6a7fd1795 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -70,4 +70,5 @@ v 1.5: If the files on Disc have changed AND there have been changes to it's in-memory data it will show a warning. You then MUST issue a '/mansave force' to overwrite the disc files, or a '/manload' to overwrite the memory data. - Fix for an error in checkFullUserPermission caused by players disconnecting mid perms update. - - Notification of being moved to the default group only happens if it's a demotion/promotion (not on join). \ No newline at end of file + - Notification of being moved to the default group only happens if it's a demotion/promotion (not on join). + - Fixed GM holding files open and causing the time stamp to be incorrect. This caused GM to require a '/mansave force' when it shouldn't be needed. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index e8e01967f..7dbeea7b1 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -338,7 +338,7 @@ public class WorldDataHolder { } this.setDefaultGroup(this.getGroup(ph.getDefaultGroup().getName())); this.removeGroupsChangedFlag(); - this.timeStampGroups = ph.getTimeStampGroups(); + this.timeStampGroups = getGroupsFile().lastModified(); ph = null; } catch (Exception ex) { @@ -368,7 +368,7 @@ public class WorldDataHolder { tempUser.clone(this); } this.removeUsersChangedFlag(); - this.timeStampUsers = ph.getTimeStampUsers(); + this.timeStampUsers = getUsersFile().lastModified(); ph = null; } catch (Exception ex) { @@ -925,6 +925,7 @@ public class WorldDataHolder { out.write(newLine); yaml.dump(root, out); + out.close(); } catch (UnsupportedEncodingException ex) { } catch (FileNotFoundException ex) { } catch (IOException e) { @@ -995,10 +996,13 @@ public class WorldDataHolder { opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); final Yaml yaml = new Yaml(opt); try { - yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8")); + OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"); + yaml.dump(root, out); + out.close(); } catch (UnsupportedEncodingException ex) { } catch (FileNotFoundException ex) { - } + } catch (IOException e) { + } } // Update the LastModified time. From 7b7d1f557f193599222ca90e74a967b3c7c0fe3c Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 17 Nov 2011 14:28:33 +0000 Subject: [PATCH 2/2] Fixed a crash on reload due to bukkit not unloading plugins before reloading. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../src/org/anjocaido/groupmanager/GroupManager.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 6a7fd1795..e9e21d407 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -71,4 +71,5 @@ v 1.5: You then MUST issue a '/mansave force' to overwrite the disc files, or a '/manload' to overwrite the memory data. - Fix for an error in checkFullUserPermission caused by players disconnecting mid perms update. - Notification of being moved to the default group only happens if it's a demotion/promotion (not on join). - - Fixed GM holding files open and causing the time stamp to be incorrect. This caused GM to require a '/mansave force' when it shouldn't be needed. \ No newline at end of file + - Fixed GM holding files open and causing the time stamp to be incorrect. This caused GM to require a '/mansave force' when it shouldn't be needed. + - Fixed a crash on reload due to bukkit not unloading plugins before reloading. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index d2d8d3b27..d8b7a15e1 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -130,6 +130,9 @@ public class GroupManager extends JavaPlugin { throw new IllegalStateException("An error ocurred while loading GroupManager"); } + // Set a few defaults (reloads) + setLoaded(false); + // Initialize the world listener and bukkit permissions to handle // events. WorldEvents = new GMWorldListener(this);