mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-27 21:29:47 +01:00
Change user housekeeper to be more lenient towards API usage (#3143)
This commit is contained in:
parent
93683c3a2f
commit
a182768cfa
@ -63,17 +63,20 @@ public class ApiUserManager extends ApiAbstractManager<User, net.luckperms.api.m
|
||||
return internal == null ? null : internal.getApiProxy();
|
||||
}
|
||||
|
||||
private net.luckperms.api.model.user.User proxyAndRegisterUsage(User internal) {
|
||||
if (internal != null) {
|
||||
this.plugin.getUserManager().getHouseKeeper().registerApiUsage(internal.getUniqueId());
|
||||
}
|
||||
return proxy(internal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull CompletableFuture<net.luckperms.api.model.user.User> loadUser(@NonNull UUID uniqueId, @Nullable String username) {
|
||||
Objects.requireNonNull(uniqueId, "uuid");
|
||||
ApiUtils.checkUsername(username, this.plugin);
|
||||
|
||||
if (this.plugin.getUserManager().getIfLoaded(uniqueId) == null) {
|
||||
this.plugin.getUserManager().getHouseKeeper().registerApiUsage(uniqueId);
|
||||
}
|
||||
|
||||
return this.plugin.getStorage().loadUser(uniqueId, username)
|
||||
.thenApply(this::proxy);
|
||||
.thenApply(this::proxyAndRegisterUsage);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -154,13 +157,13 @@ public class ApiUserManager extends ApiAbstractManager<User, net.luckperms.api.m
|
||||
@Override
|
||||
public net.luckperms.api.model.user.User getUser(@NonNull UUID uniqueId) {
|
||||
Objects.requireNonNull(uniqueId, "uuid");
|
||||
return proxy(this.handle.getIfLoaded(uniqueId));
|
||||
return proxyAndRegisterUsage(this.handle.getIfLoaded(uniqueId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.luckperms.api.model.user.User getUser(@NonNull String username) {
|
||||
Objects.requireNonNull(username, "name");
|
||||
return proxy(this.handle.getByUsername(username));
|
||||
return proxyAndRegisterUsage(this.handle.getByUsername(username));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user