mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +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);
|
Message.BULK_UPDATE_STARTING.send(sender);
|
||||||
plugin.getStorage().applyBulkUpdate(operation).thenAccept(b -> {
|
plugin.getStorage().applyBulkUpdate(operation).thenAcceptAsync(b -> {
|
||||||
if (b) {
|
if (b) {
|
||||||
|
plugin.getUpdateTaskBuffer().requestDirectly();
|
||||||
Message.BULK_UPDATE_SUCCESS.send(sender);
|
Message.BULK_UPDATE_SUCCESS.send(sender);
|
||||||
} else {
|
} else {
|
||||||
Message.BULK_UPDATE_FAILURE.send(sender);
|
Message.BULK_UPDATE_FAILURE.send(sender);
|
||||||
}
|
}
|
||||||
});
|
}, plugin.getScheduler().async());
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,8 @@ public class MongoDao extends AbstractDao {
|
|||||||
.map(MongoDao::nodeToDoc)
|
.map(MongoDao::nodeToDoc)
|
||||||
.collect(Collectors.toList());
|
.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)
|
.map(MongoDao::nodeToDoc)
|
||||||
.collect(Collectors.toList());
|
.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) {
|
public static PermissionHolder getHolderFromIdentifier(LuckPermsPlugin plugin, Sender sender, String who) {
|
||||||
if (who.startsWith("group/")) {
|
if (who.startsWith(GROUP_ID_PATTERN)) {
|
||||||
String group = who.substring("group/".length());
|
String group = who.substring(GROUP_ID_PATTERN.length());
|
||||||
Group holder = plugin.getGroupManager().getIfLoaded(group);
|
Group holder = plugin.getGroupManager().getIfLoaded(group);
|
||||||
if (holder == null) {
|
if (holder == null) {
|
||||||
Message.APPLY_EDITS_TARGET_GROUP_NOT_EXISTS.send(sender, group);
|
Message.APPLY_EDITS_TARGET_GROUP_NOT_EXISTS.send(sender, group);
|
||||||
}
|
}
|
||||||
return holder;
|
return holder;
|
||||||
} else if (who.startsWith("user/")) {
|
} else if (who.startsWith(USER_ID_PATTERN)) {
|
||||||
String user = who.substring("user/".length());
|
String user = who.substring(USER_ID_PATTERN.length());
|
||||||
UUID uuid = CommandUtils.parseUuid(user);
|
UUID uuid = CommandUtils.parseUuid(user);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
Message.APPLY_EDITS_TARGET_USER_NOT_UUID.send(sender, user);
|
Message.APPLY_EDITS_TARGET_USER_NOT_UUID.send(sender, user);
|
||||||
|
Loading…
Reference in New Issue
Block a user