summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--EssentialsGroupManager/src/Changelog.txt3
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java14
2 files changed, 16 insertions, 1 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 583200e26..baf46b004 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -228,4 +228,5 @@ v2.1:
- Update for CraftBukkit 1.7.8-R0.1(3050).
- Add UUID support.
Plugins can still query by player name but a UUID is faster and preferable.
- - Set a default mirror map if none is found in the config. \ No newline at end of file
+ - Set a default mirror map if none is found in the config.
+ - Fix clones forgetting sub groups. \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index 38663ba7d..83e170137 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -53,6 +53,10 @@ public class User extends DataUnit implements Cloneable {
User clone = new User(getDataSource(), this.getLastName());
clone.group = this.group;
+
+ // Clone all subgroups.
+ clone.subGroups.addAll(this.subGroupListStringCopy());
+
for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
@@ -72,15 +76,22 @@ public class User extends DataUnit implements Cloneable {
if (dataSource.isUserDeclared(this.getUUID())) {
return null;
}
+
User clone = dataSource.createUser(this.getUUID());
+
if (dataSource.getGroup(group) == null) {
clone.setGroup(dataSource.getDefaultGroup());
} else {
clone.setGroup(dataSource.getGroup(this.getGroupName()));
}
+
+ // Clone all subgroups.
+ clone.subGroups.addAll(this.subGroupListStringCopy());
+
for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
+
clone.variables = this.variables.clone(this);
clone.flagAsChanged();
return clone;
@@ -95,6 +106,9 @@ public class User extends DataUnit implements Cloneable {
// Set the group silently.
clone.setGroup(this.getDataSource().getGroup(this.getGroupName()), false);
+ // Clone all subgroups.
+ clone.subGroups.addAll(this.subGroupListStringCopy());
+
for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}