diff options
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java | 14 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java | 8 |
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); } |