diff options
author | ElgarL <ElgarL@Palmergames.com> | 2014-04-29 00:22:51 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-05-04 12:50:22 +0100 |
commit | 86b57804c67e033ebac53c74f853875efa5c15f3 (patch) | |
tree | efad33e13d96d8d72dcda664e1ad49f53c40d1f4 /EssentialsGroupManager/src/org | |
parent | 211dc220d891f88d5c9e58ae934c55f07092c1fe (diff) | |
download | Essentials-86b57804c67e033ebac53c74f853875efa5c15f3.tar Essentials-86b57804c67e033ebac53c74f853875efa5c15f3.tar.gz Essentials-86b57804c67e033ebac53c74f853875efa5c15f3.tar.lz Essentials-86b57804c67e033ebac53c74f853875efa5c15f3.tar.xz Essentials-86b57804c67e033ebac53c74f853875efa5c15f3.zip |
Fix clones forgetting sub groups.
Diffstat (limited to 'EssentialsGroupManager/src/org')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java | 14 |
1 files changed, 14 insertions, 0 deletions
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); } |