mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 03:25:19 +01:00
Run a sync task after completing a bulk update (#579)
This commit is contained in:
parent
800749c5ed
commit
0d9034504e
@ -72,13 +72,14 @@ public class BulkUpdateCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
Message.BULK_UPDATE_STARTING.send(sender);
|
||||
plugin.getStorage().applyBulkUpdate(operation).thenAccept(b -> {
|
||||
plugin.getStorage().applyBulkUpdate(operation).thenAcceptAsync(b -> {
|
||||
if (b) {
|
||||
plugin.getUpdateTaskBuffer().requestDirectly();
|
||||
Message.BULK_UPDATE_SUCCESS.send(sender);
|
||||
} else {
|
||||
Message.BULK_UPDATE_FAILURE.send(sender);
|
||||
}
|
||||
});
|
||||
}, plugin.getScheduler().async());
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,8 @@ public class MongoDao extends AbstractDao {
|
||||
.map(MongoDao::nodeToDoc)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
c.replaceOne(new Document("_id", uuid), d.append("permissions", newNodes));
|
||||
d.append("permissions", newNodes).remove("perms");
|
||||
c.replaceOne(new Document("_id", uuid), d);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -252,7 +253,8 @@ public class MongoDao extends AbstractDao {
|
||||
.map(MongoDao::nodeToDoc)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
c.replaceOne(new Document("_id", holder), d.append("permissions", newNodes));
|
||||
d.append("permissions", newNodes).remove("perms");
|
||||
c.replaceOne(new Document("_id", holder), d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,15 +80,15 @@ public class WebEditorUtils {
|
||||
}
|
||||
|
||||
public static PermissionHolder getHolderFromIdentifier(LuckPermsPlugin plugin, Sender sender, String who) {
|
||||
if (who.startsWith("group/")) {
|
||||
String group = who.substring("group/".length());
|
||||
if (who.startsWith(GROUP_ID_PATTERN)) {
|
||||
String group = who.substring(GROUP_ID_PATTERN.length());
|
||||
Group holder = plugin.getGroupManager().getIfLoaded(group);
|
||||
if (holder == null) {
|
||||
Message.APPLY_EDITS_TARGET_GROUP_NOT_EXISTS.send(sender, group);
|
||||
}
|
||||
return holder;
|
||||
} else if (who.startsWith("user/")) {
|
||||
String user = who.substring("user/".length());
|
||||
} else if (who.startsWith(USER_ID_PATTERN)) {
|
||||
String user = who.substring(USER_ID_PATTERN.length());
|
||||
UUID uuid = CommandUtils.parseUuid(user);
|
||||
if (uuid == null) {
|
||||
Message.APPLY_EDITS_TARGET_USER_NOT_UUID.send(sender, user);
|
||||
|
Loading…
Reference in New Issue
Block a user