diff options
author | ElgarL <ElgarL@palmergames.com> | 2011-11-04 23:13:42 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2011-11-04 23:13:42 +0000 |
commit | 1c7e0e5b9fe3045ac5e14884f8fb0a1def5f0f99 (patch) | |
tree | 817172713732b8738bb4fe6a954430cab69568d1 /EssentialsGroupManager | |
parent | e7234e621dc9c6dfb09011eb9ef5338d8824368f (diff) | |
download | Essentials-1c7e0e5b9fe3045ac5e14884f8fb0a1def5f0f99.tar Essentials-1c7e0e5b9fe3045ac5e14884f8fb0a1def5f0f99.tar.gz Essentials-1c7e0e5b9fe3045ac5e14884f8fb0a1def5f0f99.tar.lz Essentials-1c7e0e5b9fe3045ac5e14884f8fb0a1def5f0f99.tar.xz Essentials-1c7e0e5b9fe3045ac5e14884f8fb0a1def5f0f99.zip |
Fix for file date conflict causing memory data to be wiped.
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index 4140cbfea..1d07cdbe2 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -324,8 +324,12 @@ public class WorldDataHolder { public void reloadGroups() { GroupManager.setLoaded(false); try { - resetGroups(); - loadGroups(this, getGroupsFile()); + // temporary holder in case the load fails. + WorldDataHolder ph = new WorldDataHolder(this.getName()); + loadGroups(ph, getGroupsFile()); + this.groups = ph.getGroups(); + this.removeGroupsChangedFlag(); + this.timeStampGroups = ph.getTimeStampGroups(); } catch (Exception ex) { Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex); } @@ -335,8 +339,12 @@ public class WorldDataHolder { public void reloadUsers() { GroupManager.setLoaded(false); try { - resetUsers(); - loadUsers(this, getUsersFile()); + // temporary holder in case the load fails. + WorldDataHolder ph = new WorldDataHolder(this.getName()); + loadUsers(ph, getUsersFile()); + this.users = ph.getUsers(); + this.removeUsersChangedFlag(); + this.timeStampUsers = ph.getTimeStampUsers(); } catch (Exception ex) { Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex); } @@ -524,29 +532,6 @@ public class WorldDataHolder { } /** - * Updates the WorldDataHolder from the files - * - * @param ph - * @param groupsFile - * @param usersFile - * - * @throws FileNotFoundException - * @throws IOException - */ - public static WorldDataHolder Update(WorldDataHolder ph, File groupsFile, File usersFile) throws FileNotFoundException, IOException { - - GroupManager.setLoaded(false); - ph.resetGroups(); - loadGroups(ph, groupsFile); - - ph.resetUsers(); - loadUsers(ph, usersFile); - GroupManager.setLoaded(true); - - return ph; - } - - /** * Updates the WorldDataHolder from the Groups file * * @param ph |