Fix parents being cleared on promote/demote

This commit is contained in:
Luck 2016-11-05 07:53:18 +00:00
parent 6c9041ce40
commit e15d03ed4e
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 6 additions and 2 deletions

View File

@ -162,7 +162,9 @@ public class UserDemote extends SubCommand<User> {
return CommandResult.LOADING_ERROR; return CommandResult.LOADING_ERROR;
} }
user.clearParents(server, world); try {
user.unsetPermission(nodes.stream().findAny().get());
} catch (ObjectLacksException ignored) {}
try { try {
user.setPermission(NodeFactory.newBuilder("group." + previousGroup.getName()).setServer(server).setWorld(world).build()); user.setPermission(NodeFactory.newBuilder("group." + previousGroup.getName()).setServer(server).setWorld(world).build());
} catch (ObjectAlreadyHasException ignored) {} } catch (ObjectAlreadyHasException ignored) {}

View File

@ -162,7 +162,9 @@ public class UserPromote extends SubCommand<User> {
return CommandResult.LOADING_ERROR; return CommandResult.LOADING_ERROR;
} }
user.clearParents(server, world); try {
user.unsetPermission(nodes.stream().findAny().get());
} catch (ObjectLacksException ignored) {}
try { try {
user.setPermission(NodeFactory.newBuilder("group." + nextGroup.getName()).setServer(server).setWorld(world).build()); user.setPermission(NodeFactory.newBuilder("group." + nextGroup.getName()).setServer(server).setWorld(world).build());
} catch (ObjectAlreadyHasException ignored) {} } catch (ObjectAlreadyHasException ignored) {}