use of me.lucko.luckperms.api.caching.MetaContexts in project LuckPerms by lucko.
the class AbstractCachedData method reloadMeta.
@Nonnull
@Override
public CompletableFuture<MetaCache> reloadMeta(@Nonnull MetaContexts contexts) {
Objects.requireNonNull(contexts, "contexts");
// get the previous value - to use when recalculating
MetaCache previous = this.meta.getIfPresent(contexts);
// invalidate the entry
this.meta.invalidate(contexts);
// repopulate the cache
return CompletableFuture.supplyAsync(() -> this.meta.get(contexts, c -> calculateMeta(c, previous)));
}
use of me.lucko.luckperms.api.caching.MetaContexts in project LuckPerms by lucko.
the class DebugCommand method getPlayersData.
private static JObject getPlayersData(LuckPermsPlugin plugin) {
JObject ret = new JObject();
Set<UUID> onlinePlayers = plugin.getBootstrap().getOnlinePlayers().collect(Collectors.toSet());
ret.add("count", onlinePlayers.size());
JArray playerArray = new JArray();
for (UUID uuid : onlinePlayers) {
User user = plugin.getUserManager().getIfLoaded(uuid);
if (user == null) {
playerArray.add(new JObject().add("uniqueId", uuid.toString()).add("loaded", false));
continue;
}
playerArray.add(new JObject().add("uniqueId", uuid.toString()).add("loaded", true).add("username", user.getName().orElse("null")).add("primaryGroup", new JObject().add("type", user.getPrimaryGroup().getClass().getName()).add("value", user.getPrimaryGroup().getValue()).add("storedValue", user.getPrimaryGroup().getStoredValue().orElse("null"))).add("activeContext", () -> {
JObject obj = new JObject();
Contexts contexts = plugin.getContextForUser(user).orElse(null);
if (contexts != null) {
MetaContexts metaContexts = plugin.getContextManager().formMetaContexts(contexts);
obj.add("data", new JObject().add("permissions", serializePermissionsData(user.getCachedData().getPermissionData(contexts))).add("meta", serializeMetaData(user.getCachedData().getMetaData(metaContexts)))).add("contextSet", ContextSetJsonSerializer.serializeContextSet(contexts.getContexts())).add("settings", serializeContextsSettings(contexts)).add("metaSettings", serializeMetaContextsSettings(metaContexts));
}
return obj;
}));
}
ret.add("players", playerArray);
return ret;
}
Aggregations