mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-16 05:11:37 +01:00
Process 'give default if needed' when saving instead of after each change made in the API (#2775)
This commit is contained in:
parent
8ef871f6db
commit
c28b1949a9
@ -222,7 +222,7 @@ public class ApiPermissionHolder implements net.luckperms.api.model.PermissionHo
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (ApiPermissionHolder.this.handle.clearNodes(this.dataType, null, true)) {
|
||||
if (ApiPermissionHolder.this.handle.clearNodes(this.dataType, null, false)) {
|
||||
onNodeChange();
|
||||
}
|
||||
}
|
||||
@ -230,7 +230,7 @@ public class ApiPermissionHolder implements net.luckperms.api.model.PermissionHo
|
||||
@Override
|
||||
public void clear(@NonNull Predicate<? super Node> test) {
|
||||
Objects.requireNonNull(test, "test");
|
||||
if (ApiPermissionHolder.this.handle.removeIf(this.dataType, null, test, true)) {
|
||||
if (ApiPermissionHolder.this.handle.removeIf(this.dataType, null, test, false)) {
|
||||
onNodeChange();
|
||||
}
|
||||
}
|
||||
@ -239,7 +239,7 @@ public class ApiPermissionHolder implements net.luckperms.api.model.PermissionHo
|
||||
@Override
|
||||
public void clear(@NonNull ContextSet contextSet) {
|
||||
Objects.requireNonNull(contextSet, "contextSet");
|
||||
if (ApiPermissionHolder.this.handle.clearNodes(this.dataType, contextSet, true)) {
|
||||
if (ApiPermissionHolder.this.handle.clearNodes(this.dataType, contextSet, false)) {
|
||||
onNodeChange();
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ public class ApiPermissionHolder implements net.luckperms.api.model.PermissionHo
|
||||
public void clear(@NonNull ContextSet contextSet, @NonNull Predicate<? super Node> test) {
|
||||
Objects.requireNonNull(contextSet, "contextSet");
|
||||
Objects.requireNonNull(test, "test");
|
||||
if (ApiPermissionHolder.this.handle.removeIf(this.dataType, contextSet, test, true)) {
|
||||
if (ApiPermissionHolder.this.handle.removeIf(this.dataType, contextSet, test, false)) {
|
||||
onNodeChange();
|
||||
}
|
||||
}
|
||||
|
@ -90,8 +90,9 @@ public class ApiUserManager extends ApiAbstractManager<User, net.luckperms.api.m
|
||||
|
||||
@Override
|
||||
public @NonNull CompletableFuture<Void> saveUser(net.luckperms.api.model.user.@NonNull User user) {
|
||||
Objects.requireNonNull(user, "user");
|
||||
return this.plugin.getStorage().saveUser(ApiUser.cast(user));
|
||||
User internal = ApiUser.cast(Objects.requireNonNull(user, "user"));
|
||||
this.plugin.getUserManager().giveDefaultIfNeeded(internal);
|
||||
return this.plugin.getStorage().saveUser(internal);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user