mirror of
https://github.com/NLthijs48/AreaShop.git
synced 2024-11-23 02:35:25 +01:00
Stops the unnecessary saving of the groups file.
It would mark the groups file as changed every time the groups get loaded from the file. That would cause a unnecessary save after '/as reload' and after restart/reload of the server.
This commit is contained in:
parent
9957e02e65
commit
e23ad74744
@ -483,6 +483,7 @@ public class FileManager {
|
||||
* Save the group file to disk
|
||||
*/
|
||||
public void saveGroupsIsRequired() {
|
||||
AreaShop.debug("saveGroupsRequired() set");
|
||||
saveGroupsRequired = true;
|
||||
}
|
||||
public boolean isSaveGroupsRequired() {
|
||||
@ -490,6 +491,7 @@ public class FileManager {
|
||||
}
|
||||
|
||||
public void saveGroupsNow() {
|
||||
AreaShop.debug("saveGroupsNow() done");
|
||||
saveGroupsRequired = false;
|
||||
try {
|
||||
groupsConfig.save(groupsPath);
|
||||
|
@ -23,6 +23,7 @@ public class RegionGroup {
|
||||
setSetting("name", name);
|
||||
// Delete duplicates
|
||||
List<String> members = getMembers();
|
||||
int previousCount = members.size();
|
||||
List<String> newMembers = new ArrayList<String>();
|
||||
while(!members.isEmpty()) {
|
||||
String member = members.remove(0);
|
||||
@ -34,8 +35,9 @@ public class RegionGroup {
|
||||
members.remove(member);
|
||||
}
|
||||
}
|
||||
if(newMembers.size() != members.size()) {
|
||||
if(newMembers.size() != previousCount) {
|
||||
setSetting("regions", newMembers);
|
||||
AreaShop.debug("group save required because of changed member size");
|
||||
saveRequired();
|
||||
}
|
||||
if(getMembers().size() == 0) {
|
||||
@ -55,8 +57,6 @@ public class RegionGroup {
|
||||
} else {
|
||||
members.add(region.getName());
|
||||
setSetting("regions", members);
|
||||
region.updateSigns();
|
||||
region.updateRegionFlags();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -75,8 +75,6 @@ public class RegionGroup {
|
||||
} else {
|
||||
setSetting("regions", members);
|
||||
}
|
||||
region.updateSigns();
|
||||
region.updateRegionFlags();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user