use of me.lucko.luckperms.common.model.Group in project LuckPerms by lucko.
the class VaultChatHook method setGroupMeta.
@Override
public void setGroupMeta(String world, String name, String key, Object value) {
Objects.requireNonNull(name, "name");
Objects.requireNonNull(key, "key");
Group group = getGroup(name);
if (group == null) {
return;
}
setMeta(group, key, value, world);
}
use of me.lucko.luckperms.common.model.Group in project LuckPerms by lucko.
the class HolderSubjectData method objectSave.
private CompletableFuture<Void> objectSave(PermissionHolder t) {
// handle transient first
if (this.type == NodeMapType.TRANSIENT) {
// don't bother saving to primary storage. just refresh
if (t.getType().isUser()) {
User user = ((User) t);
return user.getRefreshBuffer().request();
} else {
return this.service.getPlugin().getUpdateTaskBuffer().request();
}
}
// handle enduring
if (t.getType().isUser()) {
User user = ((User) t);
CompletableFuture<Void> fut = new CompletableFuture<>();
this.service.getPlugin().getStorage().saveUser(user).whenCompleteAsync((v, ex) -> {
if (ex != null) {
fut.complete(null);
}
user.getRefreshBuffer().request().thenAccept(fut::complete);
}, this.service.getPlugin().getBootstrap().getScheduler().async());
return fut;
} else {
Group group = ((Group) t);
CompletableFuture<Void> fut = new CompletableFuture<>();
this.service.getPlugin().getStorage().saveGroup(group).whenCompleteAsync((v, ex) -> {
if (ex != null) {
fut.complete(null);
}
this.service.getPlugin().getUpdateTaskBuffer().request().thenAccept(fut::complete);
}, this.service.getPlugin().getBootstrap().getScheduler().async());
return fut;
}
}
Aggregations