Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import net.luckperms.api.model.user.UserManager;
import net.luckperms.api.node.Node;
import net.luckperms.api.node.matcher.NodeMatcher;
import net.luckperms.api.query.QueryMode;
import net.luckperms.api.query.QueryOptions;
import net.luckperms.api.track.DemotionResult;
import net.luckperms.api.track.PromotionResult;
Expand Down Expand Up @@ -305,8 +306,18 @@ public void nodesSet(Context ctx) throws JsonProcessingException {
@Override
public void metaGet(Context ctx) throws JsonProcessingException {
UUID uniqueId = pathParamAsUuid(ctx);

String contextJson = ctx.queryParam("context");
ContextSet contextSet = contextJson != null ? this.objectMapper.readValue(contextJson, ContextSet.class) : null;

CompletableFuture<CachedMetaData> future = loadUserCached(uniqueId)
.thenApply(user -> user.getCachedData().getMetaData());
.thenApply(user -> {
if (contextSet != null) {
return user.getCachedData().getMetaData(QueryOptions.builder(QueryMode.CONTEXTUAL).context(contextSet).build());
}

return user.getCachedData().getMetaData();
});
ctx.future(future);
}

Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/luckperms-openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,13 @@ paths:
summary: Get a users metadata
tags:
- Users
parameters:
- schema:
$ref: '#/components/schemas/ContextSet'
in: query
name: context
description: The context to filter the metadata by
required: false
responses:
'200':
description: OK
Expand Down