mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-26 16:39:45 +00:00
Fix for file date conflict causing memory data to be wiped.
This commit is contained in:
parent
e7234e621d
commit
1c7e0e5b9f
1 changed files with 12 additions and 27 deletions
|
@ -324,8 +324,12 @@ public class WorldDataHolder {
|
||||||
public void reloadGroups() {
|
public void reloadGroups() {
|
||||||
GroupManager.setLoaded(false);
|
GroupManager.setLoaded(false);
|
||||||
try {
|
try {
|
||||||
resetGroups();
|
// temporary holder in case the load fails.
|
||||||
loadGroups(this, getGroupsFile());
|
WorldDataHolder ph = new WorldDataHolder(this.getName());
|
||||||
|
loadGroups(ph, getGroupsFile());
|
||||||
|
this.groups = ph.getGroups();
|
||||||
|
this.removeGroupsChangedFlag();
|
||||||
|
this.timeStampGroups = ph.getTimeStampGroups();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
@ -335,8 +339,12 @@ public class WorldDataHolder {
|
||||||
public void reloadUsers() {
|
public void reloadUsers() {
|
||||||
GroupManager.setLoaded(false);
|
GroupManager.setLoaded(false);
|
||||||
try {
|
try {
|
||||||
resetUsers();
|
// temporary holder in case the load fails.
|
||||||
loadUsers(this, getUsersFile());
|
WorldDataHolder ph = new WorldDataHolder(this.getName());
|
||||||
|
loadUsers(ph, getUsersFile());
|
||||||
|
this.users = ph.getUsers();
|
||||||
|
this.removeUsersChangedFlag();
|
||||||
|
this.timeStampUsers = ph.getTimeStampUsers();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
@ -523,29 +531,6 @@ public class WorldDataHolder {
|
||||||
return ph;
|
return ph;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
* Updates the WorldDataHolder from the Groups file
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue