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 | 2806dc74dd6844fe9b1516263c18f3c78e6cea94 (patch) | |
tree | 4a2fe1ce3a67806ff7c697da76af45640ecacf79 /EssentialsGroupManager/src/org/anjocaido | |
parent | 1764940b186f290fbb9d818b9bd044d61648bee7 (diff) | |
download | Essentials-2806dc74dd6844fe9b1516263c18f3c78e6cea94.tar Essentials-2806dc74dd6844fe9b1516263c18f3c78e6cea94.tar.gz Essentials-2806dc74dd6844fe9b1516263c18f3c78e6cea94.tar.lz Essentials-2806dc74dd6844fe9b1516263c18f3c78e6cea94.tar.xz Essentials-2806dc74dd6844fe9b1516263c18f3c78e6cea94.zip |
Fix clones forgetting sub groups.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido')
-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); } |