mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-09 04:20:42 +01:00
Fix clones forgetting sub groups.
This commit is contained in:
parent
211dc220d8
commit
86b57804c6
@ -228,4 +228,5 @@ v2.1:
|
|||||||
- Update for CraftBukkit 1.7.8-R0.1(3050).
|
- Update for CraftBukkit 1.7.8-R0.1(3050).
|
||||||
- Add UUID support.
|
- Add UUID support.
|
||||||
Plugins can still query by player name but a UUID is faster and preferable.
|
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.
|
- Set a default mirror map if none is found in the config.
|
||||||
|
- Fix clones forgetting sub groups.
|
@ -53,6 +53,10 @@ public class User extends DataUnit implements Cloneable {
|
|||||||
|
|
||||||
User clone = new User(getDataSource(), this.getLastName());
|
User clone = new User(getDataSource(), this.getLastName());
|
||||||
clone.group = this.group;
|
clone.group = this.group;
|
||||||
|
|
||||||
|
// Clone all subgroups.
|
||||||
|
clone.subGroups.addAll(this.subGroupListStringCopy());
|
||||||
|
|
||||||
for (String perm : this.getPermissionList()) {
|
for (String perm : this.getPermissionList()) {
|
||||||
clone.addPermission(perm);
|
clone.addPermission(perm);
|
||||||
}
|
}
|
||||||
@ -72,15 +76,22 @@ public class User extends DataUnit implements Cloneable {
|
|||||||
if (dataSource.isUserDeclared(this.getUUID())) {
|
if (dataSource.isUserDeclared(this.getUUID())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
User clone = dataSource.createUser(this.getUUID());
|
User clone = dataSource.createUser(this.getUUID());
|
||||||
|
|
||||||
if (dataSource.getGroup(group) == null) {
|
if (dataSource.getGroup(group) == null) {
|
||||||
clone.setGroup(dataSource.getDefaultGroup());
|
clone.setGroup(dataSource.getDefaultGroup());
|
||||||
} else {
|
} else {
|
||||||
clone.setGroup(dataSource.getGroup(this.getGroupName()));
|
clone.setGroup(dataSource.getGroup(this.getGroupName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clone all subgroups.
|
||||||
|
clone.subGroups.addAll(this.subGroupListStringCopy());
|
||||||
|
|
||||||
for (String perm : this.getPermissionList()) {
|
for (String perm : this.getPermissionList()) {
|
||||||
clone.addPermission(perm);
|
clone.addPermission(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
clone.variables = this.variables.clone(this);
|
clone.variables = this.variables.clone(this);
|
||||||
clone.flagAsChanged();
|
clone.flagAsChanged();
|
||||||
return clone;
|
return clone;
|
||||||
@ -95,6 +106,9 @@ public class User extends DataUnit implements Cloneable {
|
|||||||
// Set the group silently.
|
// Set the group silently.
|
||||||
clone.setGroup(this.getDataSource().getGroup(this.getGroupName()), false);
|
clone.setGroup(this.getDataSource().getGroup(this.getGroupName()), false);
|
||||||
|
|
||||||
|
// Clone all subgroups.
|
||||||
|
clone.subGroups.addAll(this.subGroupListStringCopy());
|
||||||
|
|
||||||
for (String perm : this.getPermissionList()) {
|
for (String perm : this.getPermissionList()) {
|
||||||
clone.addPermission(perm);
|
clone.addPermission(perm);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user