summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-11-07 15:33:15 +0000
committerElgarL <ElgarL@palmergames.com>2011-11-07 15:33:15 +0000
commitf40260acef8ca6a9deff7c005b2b9d70816b1ef2 (patch)
tree3b833e92b93b973d1089cc91628f1cff9152dc94 /EssentialsGroupManager
parentab2e8f94f084bb1381ba8df604990796f63f5fc0 (diff)
downloadEssentials-f40260acef8ca6a9deff7c005b2b9d70816b1ef2.tar
Essentials-f40260acef8ca6a9deff7c005b2b9d70816b1ef2.tar.gz
Essentials-f40260acef8ca6a9deff7c005b2b9d70816b1ef2.tar.lz
Essentials-f40260acef8ca6a9deff7c005b2b9d70816b1ef2.tar.xz
Essentials-f40260acef8ca6a9deff7c005b2b9d70816b1ef2.zip
Minor optimization for Group loading/clone
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java14
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java8
2 files changed, 17 insertions, 5 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java
index eef5ba59e..861c5e3d4 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java
@@ -83,7 +83,6 @@ public class GlobalGroups {
public void load() {
GGroups = new YamlConfiguration();
- groups = new HashMap<String, Group>();
GroupManager.setLoaded(false);
@@ -110,7 +109,9 @@ public class GlobalGroups {
Map<String, Object> allGroups = (Map<String, Object>) GGroups.getConfigurationSection("groups").getValues(false);
// Load each groups permissions list.
- if (allGroups != null)
+ if (allGroups != null) {
+ // Clear out old groups
+ resetGlobalGroups();
for (String groupName : allGroups.keySet()) {
Group newGroup = new Group(groupName.toLowerCase());
Object element;
@@ -144,12 +145,12 @@ public class GlobalGroups {
// Push a new group
addGroup(newGroup);
}
+ }
removeGroupsChangedFlag();
setTimeStampGroups(GlobalGroupsFile.lastModified());
GroupManager.setLoaded(true);
//GlobalGroupsFile = null;
-
}
/**
@@ -352,6 +353,13 @@ public class GlobalGroups {
}
/**
+ * Resets GlobalGroups.
+ */
+ public void resetGlobalGroups() {
+ this.groups = new HashMap<String, Group>();
+ }
+
+ /**
*
* @return a collection of the groups
*/
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index 80291d066..8f5fad5cf 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -334,11 +334,13 @@ public class WorldDataHolder {
// transfer new data
resetGroups();
for (Group tempGroup : ph.getGroupList()) {
- if (tempGroup.getDataSource() != null) tempGroup.clone(this);
+ tempGroup.clone(this);
}
this.setDefaultGroup(this.getGroup(ph.getDefaultGroup().getName()));
this.removeGroupsChangedFlag();
this.timeStampGroups = ph.getTimeStampGroups();
+
+ ph = null;
} catch (Exception ex) {
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex);
}
@@ -355,7 +357,7 @@ public class WorldDataHolder {
WorldDataHolder ph = new WorldDataHolder(this.getName());
// copy groups for reference
for (Group tempGroup : this.getGroupList()) {
- if (tempGroup.getDataSource() != null) tempGroup.clone(ph);
+ tempGroup.clone(ph);
}
// setup the default group before loading user data.
ph.setDefaultGroup(ph.getGroup(this.getDefaultGroup().getName()));
@@ -367,6 +369,8 @@ public class WorldDataHolder {
}
this.removeUsersChangedFlag();
this.timeStampUsers = ph.getTimeStampUsers();
+
+ ph = null;
} catch (Exception ex) {
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex);
}